dojo editable-tree-dgrid:创建或生成dojo.store.JsonRest中支持的新行? [英] dojo editable-tree-dgrid : create or generate a new row supported in the dojo.store.JsonRest?

查看:79
本文介绍了dojo editable-tree-dgrid:创建或生成dojo.store.JsonRest中支持的新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试一种Dojo-dgrid,它是Tree和Editable。

因为我有以下要求,



我有在父列中的列(通常是最后一列)中添加按钮/图标。单击该图标,

a new子行应该生成/创建(如store.newItem())在此父行

下,此子行应该是可编辑的(有11列,其中6个可编辑,其中3个为digit.form.Select,其他3个为文本字段)。



填写可编辑区域时,(在最后一列中将有一个保存图标),单击保存图标应保存此新的Child行。



Btw,我正在使用dojo.store.JsonRest作为商店。



网格声明如下:

  var MyGrid = declare [网格,选择,键盘]); 
window.testgrid = new MyGrid(
{
store:Observable(Cache(jsonRest,Memory())),
selectionMode:none,
getBeforePut: false,
列:getColumns,
allowSelectAll:true,
minRowsPerPage:5,
maxRowsPerPage:20,
},gridContainer);

与同一个网格的多个单元格编辑相关的另一个问题是此处显示



在JsonRest中,我只能看到add,put,delete类型的方法。想知道如何用JsonRest作为商店来完成这个要求。



谢谢。

解决方案

你想使用put。商店的put方法用于插入或更新一个项目。

  var default_values = {somefield:'somevalue'}; 
default_values ['parent'] = parent_id; //我没有实际定义parent_id
testgrid.store.put(default_values).then(function(result){
testgrid.refresh();
});


I am trying a dojo-dgrid which is both Tree and Editable.
In that I have the requirement as follows,

I have a Add Button/Icon in a column(usually last column) for the parent rows. On clicking that Icon,
a new Child-row should get generated/created (like store.newItem()) under this parent Row
and this child row should be editable (there are 11 columns out of which 6 are editable,3 of them are digit.form.Select and the other 3 are Text-fields).

Upon filling the editable areas , (there will be a Save Icon in the last column) clicking the save-icon should save this new Child row.

Btw, I am using the dojo.store.JsonRest as store .

Grid Declaration is as follow:

var MyGrid = declare([Grid, Selection, Keyboard]);
window.testgrid = new MyGrid( 
{
    store       : Observable(Cache(jsonRest, Memory())),
    selectionMode : "none",
    getBeforePut: false,
    columns: getColumns,
    allowSelectAll: true,
    minRowsPerPage: 5,
    maxRowsPerPage: 20,
}, "gridContainer");

Another question related to multiple Cell edit for this same grid was posted here.

In JsonRest , I could see only add,put,delete kind of methods. Wondering how to accomplish this requirement with JsonRest as store.

Thanks.

解决方案

You would want to use put. The put method of the store is meant to insert or update an item.

var default_values = {somefield:'somevalue'};
default_values['parent'] = parent_id; //I have not actually defined parent_id
testgrid.store.put(default_values).then(function(result) {
    testgrid.refresh();
});

这篇关于dojo editable-tree-dgrid:创建或生成dojo.store.JsonRest中支持的新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆