Cancel dataSource.sync

6 posts, 1 answers
  1. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 26 Nov 2015 Link to this post

    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?

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 30 Nov 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 30 Nov 2015 Link to this post

    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.

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 02 Dec 2015 Link to this post

    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
  6. Paola
    Paola avatar
    11 posts
    Member since:
    Mar 2015

    Posted 07 Dec 2015 Link to this post

    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 ;-)

  7. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 Dec 2015 Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready