dojo editable-tree-dgrid : 创建或生成 dojo.store.JsonRest 支持的新行?

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

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

问题描述

我正在尝试一个既是树又是可编辑的 dojo-dgrid.
我的要求如下,

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

我在父行的列(通常是最后一列)中有一个添加按钮/图标.单击该图标时,
应该在此父行下生成/创建一个新的子行(如 store.newItem())
并且这个子行应该是可编辑的(有 11 列,其中 6 列是可编辑的,其中 3 列是 digit.form.Select,另外 3 列是文本字段).

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.

顺便说一句,我使用 dojo.store.JsonRest 作为 store .

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

网格声明如下:

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.

在 JsonRest 中,我只能看到 add、put、delete 类型的方法.想知道如何使用 JsonRest 作为存储来完成此要求.

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

谢谢.

推荐答案

你会想要使用 put.store 的 put 方法用于插入或更新项目.

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 支持的新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:dojo editable-tree-dgrid : 创建或生成 dojo.store.JsonRest 支持的新行?

基础教程推荐