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

BatchEdit command is not fired consistently

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
أشرف
Top achievements
Rank 1
أشرف asked on 09 Dec 2013, 04:12 PM
Greetings,

Suppose we have the following code:

var g=$find("some grid id")
var b=g.get_batchEditingManager()
var v=g.MasterTableView
 
g.add_command(function (sender, args)
    {
        if(args.get_commandName() == "BatchEdit" && args.get_tableView() == v)
            alert("save");
    });

If I call b.saveChanges(v), the event is fired and the alert will be shown, but if I call b.
saveAllChanges
saveAllChanges(), the event is not fired. Why this happens?
I looked at the code of the two methods and it appears that the grid component was designed so.

I'm in need to this functionality because I want to do a manipulation to the grid before saving.

2 Answers, 1 is accepted

Sort by
0
Accepted
Angel Petrov
Telerik team
answered on 12 Dec 2013, 01:51 PM
Hello Ashraf,

Indeed this is an issue we need to fix. Currently the OnCommand event is not fired in such scenario.

I have logged this problem into our system and our developers will have the care to include a fix for it as soon as possible. You can monitor our progress from this link.

As a token of gratitude for reporting this problem to us I have updated you Telerik points.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
أشرف
Top achievements
Rank 1
answered on 12 Dec 2013, 02:00 PM
Thank you.

I have worked around it by overriding the function:

var tempSaveTableChanges = batchManager.saveTableChanges;
 
    batchManager.saveTableChanges = function (m) // HACK:
    {
        closeSearch();
 
        tempSaveTableChanges.call(batchManager, m);
    }
     
    grid.add_command(function (sender, args)
    {
        if(args.get_commandName() == "BatchEdit" && args.get_tableView() == tableView)
            closeSearch();
    });

I mess with the grid DOM as I highlight search results using rangy, so I needed to guarantee that I clean the mess before saving or else the data may be mangled.
Tags
Grid
Asked by
أشرف
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
أشرف
Top achievements
Rank 1
Share this question
or