jQWidgets Forums

jQuery UI Widgets Forums Grid Beginner : Row Details using json

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  gtliu 12 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Beginner : Row Details using json #13933

    gtliu
    Member

    hello, sorry for my newbie question, i’m trying to use jgrid with row details, but in the example (demo), the data source is using array, can someone tell me how to change it into json? i’m trying using json but it can’t.

    in demo (example), data source is from array :

     var data = new Array();
    
                var firstNames = ["Nancy", "Andrew", "Janet", "Margaret", "Steven", "Michael", "Robert", "Laura", "Anne"];

    i’d like to using json like the other example :

    var source =
    {
    datatype: "json",
    datafields: [
    { name: 'LastName'},
    { name: 'FirstName'},
    { name: 'Title'},
    { name: 'Address'},
    { name: 'City'}
    ],
    url: 'grid_data.php',

    i’m sorry for my newbie question 🙁

    best regards,

    gtliu

    Beginner : Row Details using json #13953

    Peter Stoev
    Keymaster

    Hi gtliu,

    The data source type is not important in that scenario. For adding row details, you should do the following:

    1. Set the Grid’s “rowdetails” property to true.
    2. Set the “rowdetailstemplate” property:

    rowdetailstemplate: { rowdetails: "<div id='grid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true }

    3. Set the “initrowdetails” property to point to a function that will render the details:

    Here’s a sample: nestedgrids.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Beginner : Row Details using json #13986

    gtliu
    Member

    thx for the answer peter ^^

    anyway can i ask u to give me an example like row details.html but without arrays in local data? coz i’m still learning with json as the data 🙁
    sorry to bother you with my problem 🙁 i’m still beginner in code, but i’ve a will to learn 😀

    once again thx for ur help 🙂

    best regards,

    gtliu

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.