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

Trigger Update for a single dataItem

3 Answers 413 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 10 Apr 2017, 10:24 AM

Hi,

 

I have a kendo sortable grid which allows the user to drag and drop rows so that the rows can be re-ordered.

This re-ordering needs to be updated to a Seq variable which is part of the dataItem.

The grid itself reads, creates, updates and deletes using a rest service.

I've referred to the telerik sortable demo using the following link : http://docs.telerik.com/kendo-ui/controls/interactivity/sortable/how-to/use-sortable-grid

My grid contains more than 10 items. 

After the drag and drop operation is completed, the change function updates the Seq property in the dataItem.

When I call the dataSource.sync method, all the dataItems are pushed to the service to be updated.

I would like to send/push the single dataItem to the service which was re-ordered instead of sending all the dataItems.

I checked the dirty property and set it to true for the dataItem which I wanted to update. It did not work.

Post updates and calculations on the server, the grid dataSource will be refreshed.

Any help is appreciated.

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 12 Apr 2017, 10:39 AM

Hello,

As far as I understand the value of "Seq" field is changed for all items in order to make sure that the order will be updated properly for all items. Since they are updated using the set method they all will be marked as dirty. At this point as soon as sync method is called it will send all items with dirty flag set to true to the server. 

Even if you set the dirty flag to false for all other items and send only dragged item the new order will not be saved in the data base for the rest of the items (because only the dragged item will be sent to the server). 

Regards,
Boyan Dimitrov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Christopher
Top achievements
Rank 1
answered on 12 Apr 2017, 11:06 AM

Hello,

 

As the rows are re-ordered, the only dataItem to have it's 'Seq' field updated will be the one which was re-ordered.

I need an update to be fired for that single dataItem, since I don't want to flood my server with multiple requests.

I will be managing the 'Seq' field for the rest of the dataItems within my service code. 

Once the dataItem update is completed by the service, I will refresh the grid so that the records are re-loaded and the 'Seq' field for the rest of the items is synced in the browser.

0
Dimitar
Telerik team
answered on 14 Apr 2017, 10:32 AM
Hello,

As Boyan said, when items are reordered, then the position of all records should be updated as well. If you would like to try handling this on the server, then I would suggest you to try using the pushUpdate() method, as suggested in the following forum post.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Data Source
Asked by
Christopher
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Christopher
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or