dojox - 带有Checkbox的Datagrid - > onSet / trigger保存JsonRestStore

时间:2010-10-20 20:56:29

标签: checkbox dojo dojox.grid.datagrid

我有一个连接到JsonRestStore的datagrid(以编程方式创建)。 在该Grid中,有一些列呈现为复选框(类型:dojox.grid.cells.Bool) 一切正常,显示数据等。为了能够内联编辑,我将onApplyEdit连接到store.save。问题是,只有当我选择另一行时才会发送复选框的更改。但我想尽快触发put-Request,因为我点击了复选框。

可能吗?

我的网格数据:

store = new dojox.data.JsonRestStore({"idAttribute":"id","target":"\/settings\/edit"});

var listGridLayout = [
        {"field":"id","width":"100px;","styles":"text-align:left;","name":"Id"},
        {"field":"type","width":"150px;","styles":"text-align:left;","name":"Type"},
        {"field":"sql_fill","width":"250px;","styles":"text-align:left;","name":"SqlFill"},
        {"field":"standard","width":"150px;","styles":"text-align:left;","name":"Standard"},
        {"field":"validate","width":"150px;","styles":"text-align:left;","name":"Validate"},
        {"field":"field","width":"150px;","styles":"text-align:left;","name":"Field"},
        {"field":"tbl","width":"150px;","styles":"text-align:left;","name":"Tbl"},
        {"field":"label","width":"150px;","styles":"text-align:left;","name":"Label"},
        {"field":"reihenf","width":"50px;","styles":"text-align:center;","name":"Reihenf"},
        {"field":"pflicht","width":"150px;","styles":"text-align:left;","name":"Pflicht"},
        {"field":"descr","width":"250px;","styles":"text-align:left;","name":"Descr"},
        {"field":"gruppe","width":"150px;","styles":"text-align:left;","name":"Gruppe"}];

    listGridGrid = new dojox.grid.DataGrid({"selectionMode":"single","rowSelector":"20px","store":store,"rowsPerPage":30,"singleClickEdit":1,"style":"width:98%; height: 97%","id":"listGrid","structure":listGridLayout}), document.createElement('div');
    dojo.byId("listGrid").appendChild(listGridGrid.domNode);
    listGridGrid.startup();
    dojo.connect(listGridGrid, "onApplyEdit", function(row){        store.save();});

1 个答案:

答案 0 :(得分:4)

重复我的评论作为答案,以便你可以接受它(我们每个人都获得更多的代表;)

  

如果您改为onSelected会发生什么?