6 Answers, 1 is accepted
0
Hi Ryan,
Making individual rows read-only is not supported out of the box. It is possible to define individual columns as editable: false in the DataSource's model. When the user clicks on such field it will not enter in edit mode.
Regards,
Alexander Valchev
the Telerik team
Making individual rows read-only is not supported out of the box. It is possible to define individual columns as editable: false in the DataSource's model. When the user clicks on such field it will not enter in edit mode.
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Ryan
Top achievements
Rank 1
answered on 12 Dec 2012, 05:57 PM
Thanks for the response. Hopefully Kendo will support this capability in the future. In the meantime, here is what we are doing in the edit event handler of our grid to get around this limitation:
if ( e.model.get( "some-boolean-field-indicating-readonly" ) ) {
var myNotEditableField = $( "input", e.container );
var value = myNotEditableField.val();
var $newInput = $( '<input type="hidden" name="MyNotEditableField" id="MyNotEditableField" value="" />' + '<span>' + value + '</span>' ).val( value );
myNotEditableField.replaceWith( $newInput );
}
if ( e.model.get( "some-boolean-field-indicating-readonly" ) ) {
var myNotEditableField = $( "input", e.container );
var value = myNotEditableField.val();
var $newInput = $( '<input type="hidden" name="MyNotEditableField" id="MyNotEditableField" value="" />' + '<span>' + value + '</span>' ).val( value );
myNotEditableField.replaceWith( $newInput );
}
0

Piyush Bhatt
Top achievements
Rank 1
answered on 21 Oct 2014, 02:41 AM
Telerik,
Is there any support of Read Only Row or Cell now based on conditions? For example, in above case, before the Cell creates the Editable Controls, it should call some method that that can throw TRUE/FALSE that a user can control.
This is highly desired feature.
-Piyush Bhatt
Is there any support of Read Only Row or Cell now based on conditions? For example, in above case, before the Cell creates the Editable Controls, it should call some method that that can throw TRUE/FALSE that a user can control.
This is highly desired feature.
-Piyush Bhatt
0
Hi Piyush,
Making individual rows or cells not editable is not supported, however it could be achieved using a custom solution. For example you can use a custom columns.editor function that renders either a static value or a widget depending on certain criteria. Here is an example how this could be achieved.
Regards,
Alexander Popov
Telerik
Making individual rows or cells not editable is not supported, however it could be achieved using a custom solution. For example you can use a custom columns.editor function that renders either a static value or a widget depending on certain criteria. Here is an example how this could be achieved.
Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Piyush Bhatt
Top achievements
Rank 1
answered on 29 Oct 2014, 01:53 PM
I can understand what you are trying via custom editor - and editor can possibly be used as well - though there has to be an option while using the editor - whether to use readonly editor or to use the default provided by kendo. Reason is, in the custom editor function we don't want to create the kendo widgets ourselves and let kendo handle it as its currently doing. something like below for the dojo link you sent
function categoryDropDownEditor(container, options) {
if(options.model.Discontinued == true){ container.text(options.model.Category.CategoryName); } else { //let kendo handle this }
}
function categoryDropDownEditor(container, options) {
if(options.model.Discontinued == true){ container.text(options.model.Category.CategoryName); } else { //let kendo handle this }
}
0

Piyush Bhatt
Top achievements
Rank 1
answered on 29 Oct 2014, 06:41 PM
Here is how I found that we can override the default behavior. So In editCell - we can put a check if the cell is read only or not before calling the default function.
(function ($) {
var editCell_base = kendo.ui.Grid.fn.editCell;
kendo.ui.Grid.fn.editCell = function (cell) {
//console.log('custom editCell called');
if (cell.hasClass('some-class-read-only')) return;
return editCell_base.apply(this, cell);
}
})(jQuery);
(function ($) {
var editCell_base = kendo.ui.Grid.fn.editCell;
kendo.ui.Grid.fn.editCell = function (cell) {
//console.log('custom editCell called');
if (cell.hasClass('some-class-read-only')) return;
return editCell_base.apply(this, cell);
}
})(jQuery);