代码之家  ›  专栏  ›  技术社区  ›  Keith

使用x-kendo-template使一列可编辑

  •  0
  • Keith  · 技术社区  · 7 年前

    我正在使用一个x-kendo-template,并使用一个函数使列在单击时可编辑。它所做的是删除按钮,使所有列都可编辑,即使我在模式中指定了要保留为false的字段。

    <div id="grid"></div>
    var dataSource = new kendo.data.DataSource(
        transport:{
            read: function(options){
                // code
            },
            update: function(options){
                // code
            },
            cancel: function(options){
                // code
            },
            parameterMap: function (options, operation) {
                if (operation !== "read" && options.models) {
                    return { models: kendo.stringify(options.models) };
                }
            },
            schema: {
                model: {
                    id: "grid",
                    fields: [
                        Name: { type: "string", editable: false },
                        Value: { type: "string" }
                    ] 
                }
            }
        }
    );  
    
    
    <script id="template" type="text/x-kendo-template">
      <a class="k-button k-button-icontext k-grid-update k-cust-update k-state-selected"><span class="k-update"></span>Update</a>
      <a class="k-button k-button-icontext k-grid-cancel k-cust-cancel k-state-selected"><span class="k-cancel"></span>Cancel</a>
    </script>
    
    $('.k-grid-update').on('click', function(){       
      $("#grid").data("kendoGrid").setOptions({ editable: true });
    });
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   Onurhan Aytac    7 年前

    问题还不清楚,我不明白你们在哪里卡住了,但也许这能帮你们

    http://dojo.telerik.com/oXAjI/2