簡體   English   中英

dojox EnhancedGrid插件分頁不起作用

[英]dojox enhancedGrid Plugin Pagination is not working

在搜索網絡和SO均未成功之后,我現在尋求您的幫助。

我已經編寫了一個dojox EnhancedGrid,並希望在分頁插件中使用,但是當我調用網格時出現此錯誤:-[11:16:33.236]錯誤:需要插件分頁。

如果我刪除分頁,它將再次正常工作。 css文件也已正確加載。 我們使用dojo 1.9

除了看一下,我什么都不會錯過:

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();  
    }
});
}

提前致謝!

此致Miriam

EnhancedGrid包含插件的語法使用的是插件的聲明名稱 ,而不是其或實例(請參閱http://dojotoolkit.org/reference-guide/1.9/dojox/grid/EnhancedGrid/plugins/Pagination .html#plugin-declaration )。

您甚至不需要在需要時將插件映射到變量:

require(["dojox/grid/enhanced/plugins/Pagination"],function(){...});

在您的示例中,正確加載了IndirectSelection因為您使用了它的名稱( indirectSelection ,小寫的“ i”),而不是變量IndirectSelction (大寫的“ I”,加上錯字)。

好吧,我自己弄清楚了。 我對這種解決方案不滿意,但是似乎沒有其他方法可以將分頁實現到我的網格中。

現在我用這個:

 dojo.require("dojox.grid.enhanced.plugins.Pagination");

初始化插件,現在可以使用了。

有人知道嗎,為什么我這樣稱呼它不起作用?

require(["dojox/grid/enhanced/plugins/Pagination"],function(pagination){...});

此致Miriam

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM