datasourcesmartclientlistgrid

Smart client data source rebind


I created a smartclient data source and list grid. The autoFetchData is set to false and the list grid dataSource is set to my data source.

When I do a search I set the data source dataURL to my url and call the list grid fetchData method.

var url = "myurl?value=123";
deploymentDataSource.dataURL = url;
deploymentList.fetchData();

This works fine and the list grid displays the values correctly.

The problem is when I try and do a search again with new parameters it does not update my list grid with the new values.

var url = "myurl?value=456";
deploymentDataSource.dataURL = url;
deploymentList.fetchData();

Here is my data source and list grid:

isc.DataSource.create({
    ID: "deploymentDataSource",
    dataFormat: "json",
    fields: [
        {name: "id", title: "id"},
        {name: "date", title: "date"},
        {name: "buildNumber", title: "buildNumber"},
        {name: "projectKey", title: "projectKey"},
        {name: "planKey", title: "planKey"},
        {name: "buildEnvironment", title: "buildEnvironment"}
    ]
});


isc.ListGrid.create({
    ID: "deploymentList",
    width: 600, height: 300, alternateRecordStyles: true,
    dataSource: "deploymentDataSource",
    selectionType: "simple",
    autoFetchData: false
});

Solution

  • Try to call this after changing the DataSource.dataURL

    ListGrid.invalidateCache();
    

    and you don't need to call ListGrid.fetchData() again

    Reference: http://www.smartclient.com/docs/release/a/b/c/go.html#method..ListGrid.invalidateCache