Hello,
I am trying to change the editable option of a column. When I put this piece of code in the "onShow" event - it is to late, but if I put it in "onInit" - it is to early. Where is the place or is there a different way to overwrite the columns options?
$scope.grid.options.columns[0] = { encoded: true, editable: false, field: "Some", title: "Test" };
Hello Martin,
Here is some additional info.
The columns.editable property of Kendo UI Grid seems to have been introduced recently and it does not seem to be present in the version of Kendo UI included in Kendo UI Builder 1.1: Kendo UI v2016.1.412.
(You can confirm this by running the sample from the doc in the Dojo and changing the version of the .js file.)
The columns.editable property is included in the version of Kendo UI in the version Kendo UI Builder that is coming up.
In the version that you have, you can disable a field by setting the editor property to just return a text instead of an input field.
Example:
$scope.grid0.options.columns[0] = {
encoded: true,
editor: function (container, options) {
return container.text(options.model.CustNum);
},
field: "CustNum",
title: "Test"
};
See the following link in the forum for a discussion related to this topic:
www.telerik.com/.../how-to-make-a-non-editable-column-field
Please let me know if you need additional info.
Best regards.
Martin,
Please try this inside the "onShow" event:
var handler = $scope.$on('$includeContentLoaded', function() { $scope.grid.options.columns[0] = { encoded: true, editable: false, field: "Some", title: "Test" }; handler(); });
No, it's not working. It's still editable.
Did you get any error messages? Is the $scope.grid created at the point the trigger fires? Can you place a break-point when the trigger fire at check? An easy way to setup a break-point at that location:
var handler = $scope.$on('$includeContentLoaded', function() { debugger; $scope.grid.options.columns[0] = { encoded: true, editable: false, field: "Some", title: "Test" }; handler(); });
Hello Martin,
The issue seems to be the usage of "false".
The columns.editable property expects a function.
See: docs.telerik.com/.../grid
Please try setting using a definition like the following:
editable: function () { return false },
I hope this helps.
Hello Martin,
Here is some additional info.
The columns.editable property of Kendo UI Grid seems to have been introduced recently and it does not seem to be present in the version of Kendo UI included in Kendo UI Builder 1.1: Kendo UI v2016.1.412.
(You can confirm this by running the sample from the doc in the Dojo and changing the version of the .js file.)
The columns.editable property is included in the version of Kendo UI in the version Kendo UI Builder that is coming up.
In the version that you have, you can disable a field by setting the editor property to just return a text instead of an input field.
Example:
$scope.grid0.options.columns[0] = {
encoded: true,
editor: function (container, options) {
return container.text(options.model.CustNum);
},
field: "CustNum",
title: "Test"
};
See the following link in the forum for a discussion related to this topic:
www.telerik.com/.../how-to-make-a-non-editable-column-field
Please let me know if you need additional info.
Best regards.
Thanks a lot. Now it is working.