Kendo grid update dateitem dynamically - Javascript

1 Answer 2646 Views
Grid
Michael
Top achievements
Rank 1
Michael asked on 11 Dec 2017, 08:23 AM

I have a grid with columns name, status and updatedAt. Status column as editable and has dropdown values. When a user update status value, I have called the rest api for doing some business logic and returns response with an updated date. I want to update that date in updatedAt column.

Please help me to achieve this.

1 Answer, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 12 Dec 2017, 02:58 PM
Hello Michael,

To achieve the desired behavior handle the save event of the Grid. In the event handler, use the model set method to assign the new value to the desired field.
For example, check my testing Dojo:
I hope the above helps. Please let me know if it works for you or we should look for another solution.


Regards,
Preslav
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.
Michael
Top achievements
Rank 1
commented on 13 Dec 2017, 03:55 AM

The answer looks good and working as expected. I have one more question, I know uid of dataitem and wants to update dataitem when click external button.

 

Preslav
Telerik team
commented on 13 Dec 2017, 09:56 AM

Hello Michael,

To update an item when clicking an external button and you know the UID of a row:
  1. Select the row in the Grid with jQuery

    $("[data-uid="+myUIDvar+"]")
  2. Pass the row as a parameter of the dataItem method.
    https://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-dataItem
  3. Set the desired values.

Please, check the above approach and let me know if it works for you.


Regards,
Preslav
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
Michael
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Share this question
or