Javascript 如何通过外部文本框过滤dojo增强型网格
在我的场景中,我正在维护一个网格,该网格需要通过文本框中的onchange事件过滤特定列。根据文本更改,应过滤网格。我已经能够使用enhancedgrid提供的过滤功能,并希望在外部执行 已导入“dojox/grid/EnhancedGrid”、“dojo/data/ItemFileWriteStore”、“dojox/grid/enhanced/plugins/Pagination”、“dojox/grid/enhanced/plugins/Filter” 这在外部js文件中。A.jsJavascript 如何通过外部文本框过滤dojo增强型网格,javascript,angularjs,dojo,Javascript,Angularjs,Dojo,在我的场景中,我正在维护一个网格,该网格需要通过文本框中的onchange事件过滤特定列。根据文本更改,应过滤网格。我已经能够使用enhancedgrid提供的过滤功能,并希望在外部执行 已导入“dojox/grid/EnhancedGrid”、“dojo/data/ItemFileWriteStore”、“dojox/grid/enhanced/plugins/Pagination”、“dojox/grid/enhanced/plugins/Filter” 这在外部js文件中。A.js
grid = new EnhancedGrid({
store: new ItemFileWriteStore({
data: gridObject
}),
// "username, firstName, lastName, email, userGroupName, lastLoginValue, phoneNo, organization, status"
structure: [
{
name: "User Login Name",
field: "username",
width: "84px"
},
{
name: "First Name",
field: "firstName",
width: "84px"
},
{
name: "Last Name",
field: "lastName",
width: "70px"
},
{
name: "Email",
field: "email",
width: "70px"
}
],
rowSelector: '20px',
minRowsPerPage: 5,
rowsPerPage: 5,
plugins: {
pagination: {
pageSizes: ["10", "25", "50", "100", "All"],
description: true,
sizeSwitch: true,
pageStepper: true,
gotoButton: true,
/*page step to be displayed*/
maxPageStep: 4,
/*position of the pagination bar*/
position: "bottom"
},
filter: {
closeFilterbarButton: false,
ruleCount: 2
//itemsName: "rows"
}
}
}, "gridee");
console.log(grid);
/*append the new grid to the div*/
grid.placeAt("gridView");
grid.startup();
---------------功能端----------------
-----------html文件-----------------
这里使用angular和dojo。角度函数也被成功调用,并且能够进入filterGrid函数
网格===UsersCtrl
<input type="search" placeholder="Filter by Keywords" data-column="all" data-ng- model="grid.searchText" data-ng-change="grid.filterGrid()" data-dojo-type="dijit/form/TextBox" id="txtFilter">
<div id="gridView" style="width:100%; height:300px" align="center" class="claro"></div>
我得到这个错误类型错误:对象不是函数。请帮助克服这一点。很高兴在参考了这篇文章后,我有了一个想法 导入dijit/注册表
grid = registry.byId("grid");
if (filterText) {
grid.setQuery({"username": filterText + "*"});
} else {
grid.setQuery({"username": "*"});
}
//dijit.byId("grid").store.fetch(query: {username: filterText});
grid = registry.byId("grid");
if (filterText) {
grid.setQuery({"username": filterText + "*"});
} else {
grid.setQuery({"username": "*"});
}
//dijit.byId("grid").store.fetch(query: {username: filterText});