Frage

After searching the web and SO without any success i now ask for your help.

I've programmed a dojox EnhancedGrid and want to at the Pagination-plugin but when i call the grid i get this Error: -- [11:16:33.236] Error: Plugin Pagination is required.

If i remove the Pagination it works fine again. The the css-files are also loaded correctly. We use dojo 1.9

I don't think i miss anything but have a look:

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

Thanks in advance!

Regards, Miriam

War es hilfreich?

Lösung

The syntax for including a plugin in an EnhancedGrid uses the declaration name of the plugin, not its class or an instance of it (see http://dojotoolkit.org/reference-guide/1.9/dojox/grid/EnhancedGrid/plugins/Pagination.html#plugin-declaration).

You don't even need to map the plugin to a variable when you require it:

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

In your example, the IndirectSelection is correctly loaded because you use its name (indirectSelection, lower case 'i'), and not the variable IndirectSelction (upper case 'I', plus typo).

Andere Tipps

okay i figured it out by myself. I'm not happy with this solution but it seems there is no other way to implement the pagination into my grid.

Now i use this:

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

to initialize the plugin and now it works.

Does anybody know, why it wont work when i call it like this?

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

Regards, Miriam

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top