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

Cancel dataSource.sync

5 Answers 252 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paola
Top achievements
Rank 1
Paola asked on 27 Nov 2015, 12:31 AM

Hi,

I'm using a modified version of the custom confirmation window described here.

It works very well but sometimes I need to cancel dataSource.sync for certain grids (I'm using the ASP.NET MVC server wrapper).

I tried to use the RequestStart event of the DataSource and do a e.preventDefault() but this does not works and the request reaches the server code.

Can you help me, please?

5 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 30 Nov 2015, 09:47 AM
Hello Paola,

You can handle the dataBinding event of the grids and cancel it when necessary. Thus, the grids will not retrieve the data.



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Paola
Top achievements
Rank 1
answered on 30 Nov 2015, 05:30 PM

Unfortunately this does not works for me.

I want to remove the row from the grid but block the request to the server (because I'll send all the grid rows with the post along with other fields). 

If I handle the dataBinding event and cancel the delete, the row does not get removed from the grid because the event happens before dataSource.sync. 

 Handle the requestStart event seems the only viable option here but it does not cancel the server request.

0
Viktor Tachev
Telerik team
answered on 02 Dec 2015, 08:53 AM
Hi Paola,

In that case you can define a custom transport option and handle the data modifications manually.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Paola
Top achievements
Rank 1
answered on 07 Dec 2015, 09:08 AM

Thanks Victor but I've implemented a simpler (for me) solution:

I've added a custom "data-" attribute to the grids for which I want to cancel dataSource.sync. Then, I check for the presence of this attribute and skip the sync accordingly.

It may not be the most elegant solution, but it was a quick fix and works well ;-)

0
Accepted
Viktor Tachev
Telerik team
answered on 07 Dec 2015, 04:05 PM
Hi Paola,


I am glad that you have the issue resolved. Thank you for sharing your approach with the community.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Paola
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Paola
Top achievements
Rank 1
Share this question
or