SMART datagrid v.1 > Classes > GridDataSet
将指定在filter参数的表达式或匹配回调函数的数据行的索引返回为数组。
如果通过回调而指定,就会传递如下参数,而如果是包含在结果的行,就需要返回true。
row是目前检讨中的数据行号,而count是目前已被添加的行数。
可以被用于表达式的变量列表,已被列在下列表格。
变量 | 说明 |
---|---|
'values | 获取各个字段的值为字段名称或索引。 |
'row' | 计算中的数据行索引。 |
// 公司名称以'a'开头,并且数量大于100的行。
var rows = ds.filterRows(function (ds, row, count) {
return ds.getValue(row, 'country').indexOf('a') == 0 && ds.getValue(row, 'qty') > 100;
});
rows = grid.getRowsOfDataIndices(rows);
grid.checkAll(false);
grid.checkRows(rows);
// 获取最多10个、数量大于100的行。
var rows = ds.filterRows("values['qty'] > 100", 10);
rows = grid.getRowsOfDataIndices(rows);
grid.checkAll(false);
grid.checkRows(rows);