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

Radgrid batch edit leave the state upon save changes

7 Answers 593 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lydia
Top achievements
Rank 1
Lydia asked on 10 Mar 2014, 03:03 AM
Hi,
I am using a radgrid with batch edit mode.
However there are few things that I want to achieve, please let me know how to achieve them.

1) Upon clicking the Save Changes button (on grid_BatchEditCommand method), I will perform some checking if there's any validation error, I want to leave the radgrid in editing mode as per before clicking the save changes button.
I tried using e.canceled = true, but it seems it's like canceling all the changes (works similar like Cancel All Changes button).
So how to leave it in editing mode?

2) I have another Save button outside the grid, how to check that the radgrid is edited and not yet saved?

Thanks!

7 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 Mar 2014, 08:59 AM
Hello Lydia,

You can use the _extractChangesString  method to check whether the user has made any changes:
<ClientSettings>
    <ClientEvents OnCommand="gridCommand" />
</ClientSettings>
JavaScript:
function gridCommand(sender, args) {
    if (args.get_commandName() == "BatchEdit") {
        var changesString = sender.get_batchEditingManager()._extractChangesString(args.get_tableView());
        if (changesString.length == 0) {
            args.set_cancel(true);
        }
    }
}

In addition, you can check the following sample in case you need to prevent paging:
http://www.telerik.com/support/code-library/prevent-losing-batch-editing-changes-on-paging-or-any-other-postback

Hope this helps.


Regards,
Eyup
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Lydia
Top achievements
Rank 1
answered on 13 Mar 2014, 09:06 AM
hi Eyup thanks for your reply.
I have managed to get the same syntax from the support as well.
However how about my second question:
I have a button outside the grid and i tried to save the grid using the below syntax, but it failed in IE9, is it a bug?

grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());

I posted the question here too http://www.telerik.com/forums/how-to-fire-the-updateedited-method-from-an-outside-button



0
Eyup
Telerik team
answered on 18 Mar 2014, 08:20 AM
Hello Lydia,

From the mentioned thread, I can see that you have managed to resolve the issue.
Please feel free to turn to us if new questions arise.

Regards,
Eyup
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Vincent
Top achievements
Rank 1
answered on 09 Jul 2014, 07:54 PM
Could you please share the solution with the rest of us?  I'm personally having issues getting the saveChange method to fire with the built in SaveChanges button in BatchEdit mode and am skulking the forums attempting to find answers.
0
Eyup
Telerik team
answered on 14 Jul 2014, 11:56 AM
Hi Vincent,

Have you tried the basic sample suggested in the following post?
http://www.telerik.com/forums/how-to-fire-the-updateedited-method-from-an-outside-button#5Af7aU0fFEa0UKS5HOhyjA

In addition, you can temporarily disable any ajaxification on the page and enable your script debugger (FireBug or F12) to see whether there are any script errors interfering.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Vincent
Top achievements
Rank 1
answered on 14 Jul 2014, 10:42 PM
My challenge was that I was attempting to use the built in functionality that allows for AutomaticUpdates/Inserts/Deletes and for whatever reason this was failing.  My current workaround was manually creating the code to execute the update queries in my code behind and running that code instead of relying on the automatic update/insert/deletes as specified via parameterized queries in the SQL Data Source.

Where I left things was that some sort of post back was happening and was undoing my updates.  (i.e. the correct update would occur, followed by an update that reverted my values back to the old values).  I haven't been able to isolate where that is occurring, but turning off the automatic updates and providing my own code behind for the update query has me where I need to be for now.

I will submit a sample website to Telerik customer support to see if they can isolate why the automatic updates aren't occurring properly.  It's not quite a simple example as I'm suppressing the batch edit functionality on various cells based on the criteria of both column and row.  So it's possible that in enabling that bit of functionality I broke something unintentionally.

That, and there's a known javascript error in the latest official build that affects RowClick batch editing that interferes.

Hopefully we'll come to some resolution and I can post findings in the forum.

Thanks for the follow up!
0
Eyup
Telerik team
answered on 17 Jul 2014, 07:12 AM
Hello Vincent,

I'm glad you've managed to find a viable solution for the time being.
Please feel free to share your improvements with our community.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Lydia
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Lydia
Top achievements
Rank 1
Vincent
Top achievements
Rank 1
Share this question
or