This is a migrated thread and some comments may be shown as answers.

KendoGrid - Update Non Editable column during checkbox change event.

6 Answers 657 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Avish
Top achievements
Rank 1
Avish asked on 08 Jan 2018, 05:58 PM

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

Sort by
0
Avish
Top achievements
Rank 1
answered on 08 Jan 2018, 07:15 PM

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.

0
Konstantin Dikov
Telerik team
answered on 10 Jan 2018, 07:51 AM
Hi Avish,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Avish
Top achievements
Rank 1
answered on 16 Jan 2018, 02:50 PM

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  .

0
Stefan
Telerik team
answered on 18 Jan 2018, 12:26 PM
Hello, Avish,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Avish
Top achievements
Rank 1
answered on 19 Jan 2018, 06:54 PM

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

0
Accepted
Konstantin Dikov
Telerik team
answered on 23 Jan 2018, 02:13 PM
Hi Avish,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Avish
Top achievements
Rank 1
Answers by
Avish
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Stefan
Telerik team
Share this question
or