dojox - 带复选框的数据网格 -> onSet/触发保存JsonRestStore

发布于 2024-09-28 05:20:36 字数 1848 浏览 0 评论 0原文

我有一个连接到 JsonRestStore 的数据网格(以编程方式创建)。 在该网格中,有一些列呈现为复选框(类型: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();});

i have a datagrid (created programmatically) wich is connected to an JsonRestStore.
In that Grid there are some columns rendered as checkboxes (type:dojox.grid.cells.Bool)
Everything works fine, displaying Data and so on. To be able to edit inline, i connected the onApplyEdit to store.save. The Problem is, that the change of the checkbox is only sent if i select another row. But i want to trigger a put-Request as soon, as i click on the checkbox.

is that possible?

my Grid-Data:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的心境我的脸 2024-10-05 05:20:36

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

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

Repeating my comment as an answer so you can accept it (and we each earn more rep ;) )

what happens if you snag onSelected instead?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文