0
votes

I'm using a x-kendo-template and using a function to make a column editable on click. What its doing is erasing the button, making all columns editable, even though I've specified in the schema for the fields I want to remain 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 });
});

So based on this, Name should not be editable and Value should once the button is clicked.

1
The schema.model id: value might be incorrect. The id: value should be the name of a field in the data record that uniquely identifies each row -- in your case it could be Name, or perhaps some other field, such as rowId that is the identity column in the data base table. - Richard
You don't show the grid creation code. Can you create a working Dojo using local data that demonstrates the problem ? - Richard

1 Answers

0
votes

question is not clear, i dont get it where are you stuck but maybe this can help you

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

this example uses x-kendo-tmpl and you can disable editing for one col with

dataSource -> schema -> model -> fields -> -> editable: false