Question

I am trying to make a Dojo Grid with checkbox (multiple columns are checkbox) and I am trying to make them alwaysEditing.

I used type = dojox.grid.cells.Bool but I think it does not allow me to click the checkbox, I tried to see what happens on the http request and it seems to send undefined parameters each time i click on the checkbox. I am not sure how to add other method in the JsonRestStore, is there any other method that is needed?

Here is the code:

require([
    "dojox/grid/DataGrid",
    "dojo/store/JsonRest",
    "dojo/data/ObjectStore",
    "dijit/form/Form",
    "dojo/domReady!"
], function(DataGrid,JsonRestStore,ObjectStore,dijitForm, request){
    SalesFormGridStore = new JsonRestStore({target:"/sales/SalesForm/DataRequestedDojoGrid/", idProperty: "OrderNo"});
    SalesFormGridDataStore = new ObjectStore({objectStore: SalesFormGridStore});
    SalesFormGridStructure = {
        cells: [
            // Column definitions start...
            { 
                name: 'Delivery?', 
                field: 'DeliveryFlag', 
                width: '40px', 
                styles: 'text-align: center;', 
                editable: true, 
                alwaysEditing: true, 
                type: dojox.grid.cells.Bool, 
                editor: dojox.grid.cells.CheckBox
            } 
            // Column definitions end....
        ]
    };
    SalesFormGridGrid = new DataGrid({
        store: SalesFormGridDataStore,
        structure : SalesFormGridStructure,
    }, "SalesFormGrid");
    SalesFormGridGrid.startup();
});

When the form loads or if you scroll outside the range, it request a normal query.

/sales/SalesForm/DataRequestedDojoGrid/

But when I click on the checkbox, it does not allow me to click it and it just request the following request.

/sales/SalesForm/DataRequestedDojoGrid/1

/sales/SalesForm/DataRequestedDojoGrid/2

Would I need to wire the click event manually?

Was it helpful?

Solution

I somehow got the answer.

I just followed the example of the codeproject tutorial here.

Basically, I used a memory store and cache store object. Before I just directly link the json store to the object store.

SalesFormGridMemoryStore = new MemoryStore({ idProperty: "SalesNo" });
SalesFormGridJsonStore = new JsonRestStore({target:"/sales/SalesForm/DataRequestedDojoGrid/", idProperty: "SalesNo"});
SalesFormGridCacheStore = new CacheStore(SalesFormGridJsonStore, SalesFormGridMemoryStore);
SalesFormGridObjectStore = new ObjectStore({objectStore: SalesFormGridCacheStore});

Since there is no cache and memory store before, all edit needs to be directly send to the master store which is the json store.

Hope this helps somebody.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top