jQWidgets Forums

jQuery UI Widgets Forums Grid Binding to properties of properties

This topic contains 2 replies, has 2 voices, and was last updated by  richardjansen 10 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Binding to properties of properties #57121

    Steelhound
    Participant

    Hi all!

    I’m sure it’s quite simple issue, but I can’t get it working…

    I have such a JSON object:

    {
    “Id”: 1,
    “Name”: “Blablabla”,
    “ABC”: {
    “A”: 5,
    “B”: 6,
    “C”: 7,
    }
    }

    and I want it to my jqxGrid.
    There is no problems with binding properties like Id or Name:

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘Id’, type: ‘int’ },
    { name: ‘Name’, type: ‘string’ }
    ],
    localdata: data
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(‘div’).jqxGrid(
    {
    width: ‘100%’,
    source: dataAdapter,
    columnsresize: false,
    columns: [
    { text: ‘Id’, datafield: ‘Id’, width: ‘50%’ },
    { text: ‘Name’, datafield: ‘Name’, width: ’50’ }
    ]

    but how can I make a column for ABC.A or ABC.B?
    I always have empty data inside (I’ve tried ABC.A, ABC[0], ABC.0.A and etc…)
    Seems like I should set some extra properties for datafields or etc…

    Thank you in advance!

    Binding to properties of properties #57123

    Steelhound
    Participant

    Found it…. Name: ‘ABC’, map: ‘ABC>A’

    Simple 🙂

    Binding to properties of properties #58305

    richardjansen
    Participant

    Great. I was looking for the same. But actually I want to keep the nesting in my data adapter and assign a ‘map’ attribute (with the > path) in my jqxGrid ‘columns’ attribute. So keep the original json structure as is and read the nested data when I need it. Unfortunately jqxGrid can’t handle this.

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

You must be logged in to reply to this topic.