繁体   English   中英

添加行后进行编辑时,剑道网格行消失

[英]Kendo grid row disapeared when editing after adding a row

我定义了一个这样的kendo网格,并在添加一行后以某种方式单击了我所做的第一个编辑单击(在发送到服务器之前),而我刚添加的行正在消失,并且刷新后仍然存在。 有什么建议为什么会发生吗?

$("#actionGrid").kendoGrid({          
    scrollable: true,
    height: "200px",
    toolbar: [{name: "create", text: "Add"}],
    editable: {
        mode: "inline",
        confirmation: false
    },
    columns: [
        { field: "order", title: "Order", width: 80 },
        { field: "action", title: "Action name"},           
        { command: ["edit", "destroy"], width: 100 }                       
    ],
    dataSource: {
        schema: {
            model: {
                id:"taskId",
                    fields: {
                        taskId: { type:"number" },
                        order: { type: "number", validation: { min: 0 } },                          
                        action: {}
                    }
                }
            },
         transport: {
                read: {
                    dataType: "json",
                    type: "GET",
                    contentType: "application/json",
                    url: "action/readByPId?pId=" + pId
                },
                destroy: {
                    dataType:"json",
                    type:"POST",
                    contentType:"application/json",
                    url: "action/delete"
                },
                update: {
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json",
                    url: "action/update"
                },
                create: {
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json",
                    url: "action/update"
                },                                     
                parameterMap:function parameterMap(options,type) { 
                    if(type !== "read"){        
                        return JSON.stringify(options);
                    }
                }
            },
         sort: { field: "order", dir: "asc" }
        }
    });

Kendo Grid有明确的规则。就像每次创建新记录一样,必须将更新的列表返回给客户端调用。 请确保该更新记录是否正在返回。

如果您正在执行kendo UI的在线离线功能。 然后按照下面的演示。 https://demos.telerik.com/kendo-ui/grid/offline

您还没有提到数据通信方法。 但是,如果您使用的是纯自定义方式,则必须在执行任何操作后更新datasoure。请放入以下代码以获取新数据的更新。

$('#GridName').data('kendoGrid').dataSource.read(); <!--  first reload data source -->

$('#GridName').data('kendoGrid').refresh(); <!--  refresh current UI -->

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM