Hi All,
i am new to KendoGrid ,i am facing couple of issues while implementing teh requirement. Any pointers will be highly appreciated.
1) In my grid i have couple of columns , column-1 ( checkbox) and column-2 ( amount/Numeric) . column-2 is non editable. The requirement is if i click on column-1 ( checkbox) column-2 value should get replace/copied over from some other column (say column-n) . the problem is since its non-editable i am not able to update this column on checkbox click event. if i make column-2 as editable then its working fine. But requirement is prevent it from manual editing should only be edited from column-1 checkbox click event . do i need to call editCell and closeCell in checkbox click event method as a workaround.
2) How can i call validate event on column-2 , seems we are updating the column via checkbox click event and not manually( dell edit) , so validation method is not invoked.
6 Answers, 1 is accepted
Hi All , i am able to accomplish #1 by dataItem.[column2]=<required Value> instead of using dataItem.set("column2",<required Value>.
as set wont work with non-editable column.
#2 - I am still checking how to call the custom validation as the change is not done by updating the cell manually.
If you need to validate the value you need to add the validation logic before changing the value in the model, because the Kendo Validator works over input elements and Kendo editors.
As for the changing the model values, please ensure that you set the dirty property of the dataItem to true, so it could be handled as updated.
Additionally, setting fields as non editable when you need to edit them should be avoided. If you need to disable the editing for a column you can use column.editable instead:
Regards,
Konstantin Dikov
Progress Telerik
Thanks a lot for your help Konstantin
can i suppress dirty field indicator in one column . it should be turned on for other columns as expected . but that read only column should not be updated with with dirty indicator color flag /red triangle in the corner .
The desired result can be achieved using CSS:
https://docs.telerik.com/kendo-ui/knowledge-base/disable-dirty-indicator-using-css
The CSS selector has to be made more specific in order to remove it for only a specific column:
/*This is disable it for the first column only*/
<style>
td:first-child .k-dirty{
display
:
none
;
}
</style>
Regards,
Stefan
Progress Telerik
Thanks a lot Stefan for the response, i tried a different approach to unmark the red indicator.
#1 - Also is to possible to unmark the dirty indicator not at CSS but at data level ( incase the column is just read only and doesn't help in case of any business validation so we should not get the cell/row as dirty)
#2 - is there any way to get all the dirty records in one fetch without looping through all the grid rows looking for dirty indicator .
CSS
====
.k-dirty-clear span {
border-width:0;
}
column level detail
-----------------------
attributes:{"class": "k-dirty-unmark"}
If you need to remove the dirty indicator at data level you will have to traverse all records and their corresponding TR elements and remove the class name for the dirty indicator from the TD elements.
For the second question, currently there is no method that will return only the changed records.
Regards,
Konstantin Dikov
Progress Telerik