Colums options editable

Posted by Martin Velikov on 05-Jul-2017 12:39

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"
                    };

Posted by egarcia on 05-Jul-2017 22:49

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.

All Replies

Posted by Ricardo Perdigao on 05-Jul-2017 13:01

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();
	});

Posted by Martin Velikov on 05-Jul-2017 13:14

No, it's not working. It's still editable.

Posted by Ricardo Perdigao on 05-Jul-2017 13:30

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();
});

Posted by egarcia on 05-Jul-2017 14:44

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.

Posted by egarcia on 05-Jul-2017 22:49

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.

Posted by Martin Velikov on 06-Jul-2017 01:47

Thanks a lot. Now it is working.

This thread is closed