Javascript dojox enhancedGrid插件分页不起作用
在搜索了网络之后,我没有任何成功,现在请求您的帮助 我已经编写了一个dojox EnhancedGrid,并希望在分页插件中找到它,但是当我调用grid时,我得到了以下错误:-- [11:16:33.236]错误:需要插件分页 如果我删除分页,它会再次正常工作。css文件也已正确加载。我们使用Dojo1.9 我想我没有错过任何东西,只是看看:Javascript dojox enhancedGrid插件分页不起作用,javascript,dojo,pagination,dojox.grid,Javascript,Dojo,Pagination,Dojox.grid,在搜索了网络之后,我没有任何成功,现在请求您的帮助 我已经编写了一个dojox EnhancedGrid,并希望在分页插件中找到它,但是当我调用grid时,我得到了以下错误:-- [11:16:33.236]错误:需要插件分页 如果我删除分页,它会再次正常工作。css文件也已正确加载。我们使用Dojo1.9 我想我没有错过任何东西,只是看看: require([ "dojo/dom-style", "dijit/form/CheckBox", "dojo/dom",
require([
"dojo/dom-style",
"dijit/form/CheckBox",
"dojo/dom",
"dojo/on",
"dojo/_base/array",
"dojox/grid/DataGrid",
"dojox/grid/EnhancedGrid",
"dojox/grid/enhanced/plugins/IndirectSelection",
"dojox/grid/enhanced/plugins/Pagination",
"dojox/grid/enhanced/plugins/exporter/CSVWriter",
"dojo/data/ItemFileReadStore",
"dojo/data/ObjectStore",
"dojo/store/Memory",
"dojo/dom-construct",
"dijit/registry",
"dojo/json",
"dojo/dom-style",
"dojo/domReady!"],
function(
domStyle,
checkbox,
dom,
on,
array,
DataGrid,
EnhancedGrid,
IndirectSelection,
Pagination,
CSVWriter,
ItemFileReadStore,
ObjectStore,
Memory,
domConstruct,
registry,
domStyle,
JSON){
var ErgebnisPane;
var selectedMessPunkte = [];
var MPStore;
if (idResults.length) {
dojo.style("DefaultContentPane",'height','180px');
dojo.style("DefaultContentPane",'width','200px');
dojo.style(dojo.byId("DefaultTitlePane"), "display", "block");
array.forEach(idResults, function(list){
selectedMessPunkte.push({
ident: list.feature.attributes.OBJECTID,
numbez: list.feature.attributes.NUMBEZ,
pnr: list.feature.attributes.PNR,
r: list.feature.attributes.R,
h: list.feature.attributes.H,
hoehe: list.feature.attributes.HÖHE,
vma: list.feature.attributes.VMA,
geo: list
});
});
var dataItems = {
identifier: 'ident',
items:selectedMessPunkte
};
//Datastore füllen
var store = new Memory({data:dataItems});
MPStore = new ObjectStore({objectStore: store});
//Grid Layout erstellen
var layout = [
{name:"ID", field: "ident"},
{name:"Numerierungsbezirk", field: "numbez"},
{name:"Punktnummer", field: "pnr"},
{name:"Rechtswert", field: "r"},
{name:"Hochwert", field: "h"},
{name:"Hoehe", field: "hoehe"},
{name:"Vermarkungsart", field: "vma"}
];
MPSGrid = new EnhancedGrid({
id: 'MPSGrid',
store: MPStore,
query: { ident: "*" },
structure: layout,
rowSelector: '20px',
keepSelection: false,
plugins: {
indirectSelection: {
headerSelector:false,
width:"40px",
styles:"text-align: center;"
},
Pagination: {
description: true,
pageStepper: true,
sizeSwitch: true,
pageSizes: ["25","50","100","All"],
maxPageStep: 4,
position: "bottom"
}
}
});
MPSGrid.placeAt("DefaultContentPane");
MPSGrid.startup();
}
});
}
提前谢谢
你好,米里亚姆好的,我自己想出来的。我对这个解决方案不满意,但它 似乎没有其他方法可以在我的网格中实现分页 现在我用这个:
dojo.require("dojox.grid.enhanced.plugins.Pagination");
初始化插件,现在它可以工作了
有人知道吗,为什么我这样称呼它是行不通的
require(["dojox/grid/enhanced/plugins/Pagination"],function(pagination){...});
在这方面,Miriam在
EnhancedGrid
中包含插件的语法使用插件的声明名称,而不是其类或其实例(请参阅)
您甚至不需要在需要时将插件映射到变量:
require(["dojox/grid/enhanced/plugins/Pagination"],function(){...});
在您的示例中,正确加载了间接选择
,因为您使用了它的名称(间接选择
,小写“i”),而不是变量间接选择
(大写“i”,加上打字)