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

[Solved] Trigger submit on client side and event on "Cancel Changes"

3 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
IT
Top achievements
Rank 1
IT asked on 08 Aug 2011, 03:44 AM
I'm building a grid into a form and I'm looking for a solution to two issues:-

The first is that I have InCell editing in the grid, which is working fine, however I have controls outside the grid that add records using getJSON and then call ajaxRequest() to refresh the grid. If the user has made changes in the grid, but not yet clicked "Save Changes", then the changes are lost when ajaxRequest() is called. I would like to somehow force the grid to save before calling ajaxRequest(), however I cannot see a client side method to do this.

I also couldn't find a property that told me if the grid had unsaved changes... in the interim, I have added a "dirty" flag that gets set to true whenever OnSave fires, and is cleared whenever OnSubmitChanges fires... which is fine, however the user might click "Cancel Changes", and I would like to clear the "dirty" flag, however I can't see an event that fires when "Cancel Changes" is clicked, as with "Save Changes"

In summary:-

- Is there a client side method to "submit" the grid when InCell editing is used?
- Is there a client side property that can tell me if there are unsubmitted/outstanding changes in a grid when using InCell editing?
- Is there a client side event for "Cancel Changes" like OnSubmitChanges is for "Save Changes"

Many thanks in advance

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Aug 2011, 09:43 AM
Hi Aleks,

 You can use the hasChanges() client-side method to check for any pending changes. The submitChanges() method will send the data to the server. Unfortunately there is no event for cancelling changes. However you can probably subscribe to the click event of the cancel button:

$(".t-grid-cancel-changes").click(function() {
    
});

Regards,
Atanas Korchev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

0
IT
Top achievements
Rank 1
answered on 11 Aug 2011, 07:23 AM
Those work...many thanks.

Can you suggest to whoever manages the documentation that these should be included in the help files for the next version? hasChanges() and submitChanges() aren't in the docs for MVC Q2 2011
0
Atanas Korchev
Telerik team
answered on 11 Aug 2011, 07:46 AM
Hello Aleks,

 We will make sure to update the documentation for the next help update.

Regards,
Atanas Korchev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

Tags
Grid
Asked by
IT
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
IT
Top achievements
Rank 1
Share this question
or