BatchEdit command is not fired consistently

3 posts, 1 answers
  1. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 09 Dec 2013 Link to this post

    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. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 12 Dec 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 12 Dec 2013 Link to this post

    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.
Back to Top