我有一个HTML下拉列表,其值为“aa,bb,cc”。如何使用带有网格列“SchedulingAssistant”的HTML下拉列表来过滤dojo网格。 我使用以下代码来创建和显示网格:
var CurrentColumnsLayout;
var CurrentData = {identifier: 'id',label: 'id',items: []};
var ConvertedDisplayArray = $.toJSON(DisplayArray);
var EvalDisplayArray = eval('(' +ConvertedDisplayArray+ ')');
for(var j = 0, l = EvalDisplayArray.length; j < EvalDisplayArray.length; j++)
{
CurrentData.items.push(dojo.mixin({id:j}, EvalDisplayArray[j%l]));
}
CurrentDataStore = new dojo.data.ItemFileWriteStore({data:CurrentData});
CurrentColumnsLayout = [{field: 'id',name: 'id',width: 'auto',hidden:'true'},{field: 'CaseID',name: 'Case ID',width: 'auto'},{field: 'SchedulingAssistant',name: 'Schd. Assistant',width: 'auto'},{field: 'ServiceStatus',name: 'Status',width: 'auto', formatter:FormatStatus}];
var CurrentGrid = new dojox.grid.DataGrid({store: CurrentDataStore,structure: CurrentColumnsLayout,noDataMessage: "No results found.", selectionMode: 'single'},document.createElement('div'));
dojo.byId("IntakeFirstDiv").appendChild(CurrentGrid.domNode);
CurrentGrid.startup();
答案 0 :(得分:1)
在网格上使用filter()方法:http://livedocs.dojotoolkit.org/dojox/grid/DataGrid#filtering-data
因此,在您的下拉列表中,您可以在onChange事件中添加类似的内容:
grid.filter({yourColumn: 'someValue'});