Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    datasource fields from response

    Is there a way to get all fields into datasource from the response body?
    I have a single grid bound to a datasource that retrieves different number and name of fields from URL depending on criteria. If I explicitly create fields array in datasource like
    Code:
    isc.DataSource.create({
    ID: "singlegrid",
    dataURL:"modules/allgrid.xql?CLASS=FTM",
    fields:[{name: "distName"},{name:"softwareReleaseVersion"},{name:"systemTitle"}
    ],
    recordXPath:"//record"
    });
    grid gets populated with fields corrrectly but if I remove
    Code:
    fields:[{name: "distName"},{name:"softwareReleaseVersion"},{name:"systemTitle"}
    ],
    from the above - grid is always empty. Is there a way to tell datasource to get all field names from the response?
    Thanks
    Last edited by mambo_jumbo; 7 Sep 2015, 23:09.

    #2
    The fields ultimately need to be provided to either the DataSource or the ListGrid. You can do this dynamically, by making your DataSource call with a DataSource with no fields, then creating a ListGrid with appropriate fields on the fly (after inspecting the response).

    Bear in mind that fields are how you tell components what data types to use. A lot of formatting, sorting and other behaviors won't work as expected unless fields exist to convey type information (for example, numbers and dates would just sort in text order).

    Comment

    Working...
    X