0

我正在尝试使用复选框(多列是复选框)制作 Dojo Grid,并且我正在尝试使它们始终编辑。

我使用了 type = dojox.grid.cells.Bool 但我认为它不允许我单击复选框,我试图查看 http 请求上发生了什么,并且每次单击复选框时似乎都会发送未定义的参数。我不确定如何在 JsonRestStore 中添加其他方法,是否需要其他方法?

这是代码:

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

当表单加载或滚动超出范围时,它会请求正常查询。

/sales/SalesForm/DataRequestedDojoGrid/

但是当我点击复选框时,它不允许我点击它,它只是请求以下请求。

/sales/SalesForm/DataRequestedDojoGrid/1

/sales/SalesForm/DataRequestedDojoGrid/2

我需要手动连接点击事件吗?

4

1 回答 1

0

我不知何故得到了答案。

我只是按照这里的 codeproject 教程的例子。

基本上,我使用了内存存储和缓存存储对象。在我直接将 json 存储链接到对象存储之前。

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

由于之前没有缓存和内存存储,所有编辑都需要直接发送到主存储,即 json 存储。

希望这可以帮助某人。

于 2014-01-06T07:44:57.747 回答