我创建了一个smartclient数据源和列表网格。 autoFetchData设置为false,列表网格dataSource设置为我的数据源。
当我进行搜索时,我将数据源dataURL设置为我的url并调用列表网格fetchData方法。
var url = "myurl?value=123";
deploymentDataSource.dataURL = url;
deploymentList.fetchData();
这很好用,列表网格正确显示值。
问题是,当我尝试使用新参数再次搜索时,它不会使用新值更新列表网格。
var url = "myurl?value=456";
deploymentDataSource.dataURL = url;
deploymentList.fetchData();
这是我的数据源和列表网格:
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
});
答案 0 :(得分:1)
尝试在更改DataSource.dataURL
ListGrid.invalidateCache();
,您无需再次致电ListGrid.fetchData()
参考: http://www.smartclient.com/docs/release/a/b/c/go.html#method..ListGrid.invalidateCache