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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)