我从数据库得到了
的结果var dataSource = [{ "ID": 1, "ProductName": "P1", "InYear": 2015, "Revenue": 500 },
{ "ID": 2, "ProductName": "P2", "InYear": 2015, "Revenue": 700 },
{ "ID": 3, "ProductName": "P3", "InYear": 2015, "Revenue": 600 },
{ "ID": 4, "ProductName": "P1", "InYear": 2016, "Revenue": 800 },
{ "ID": 5, "ProductName": "P2", "InYear": 2016, "Revenue": 900 },
{ "ID": 6, "ProductName": "P3", "InYear": 2016, "Revenue": 400 }]
我需要过滤数据。所以我使用过滤器选项如下
var newDataSource = new DevExpress.data.DataSource({
dataSource: dataSource,
filter: [
["InYear", ">=", startFromYear],
"&&",
["InYear", "<=", endWithYear]
],
});
其中startFromYear = 2014年和endWithYear = 2016年。
我用过
newDataSource.load();
alert('length'+newDataSource.items.length);
$('#chartContainer').dxChart('instance').option('dataSource', newDataSource);
过滤后我得到长度= 0的结果。我没有得到结果。我可以知道我犯了什么错误吗?
提前致谢