Grid rows don't close ordinarily if the batchEditClosing is cancelled

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

    Posted 06 Jan 2014 Link to this post

    Greetings,

    I have a batch mode grid that's required to be able to display a dialog when the user is editing a row, and the user will interact with the dialog in some way.
    I used a RadWindow for the dialog, and because the grid closes the currently edited row if the user clicks outside the row, I added the following code to prevent the grid from closing the currently edited row while the dialog is shown:

    function dialog_beforeShow(sender, args)
        {
            grid.add_batchEditClosing(grid_batchEditClosing);
        }
     
        function grid_batchEditClosing(sender, args)
        {
            args.set_cancel(true);
        }
     
    function dialog_close(sender, args)
        {
            grid.remove_batchEditClosing(grid_batchEditClosing);
        }

    After the dialog is closed, I find that the row doesn't close if I click with mouse anywhere.
    It only closes if I open another row for editing.
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 09 Jan 2014 Link to this post

    Hi Ashraf,

    Since the event handler is detached you should not experience such behavior. Could you ensure that a JavaScript error is not present on the page that might be breaking the functionality? Additionally please share with us the contents of the problematic page so we could review the scenario more carefully.

    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 Jan 2014 Link to this post

    I created a small website in which the problem is reproduced. You may download it from here.

    1. Run the application with the latest release of RadControls.
    2. Open any of the grid rows for editing.
    3. Move the focus to the "Name" cell, then press CTRL and E keys.
    4. The dialog will be shown. Watch your console.
    5. Click with the mouse inside the dialog, you will see some statements logged in the console on the first click.
    6. On the next clicks, nothing is logged. The batchEditClosing event handler is not called.
    7. Close the dialog, then click on anywhere on the page. the open line won't be closed.

    The open line won't be closed until you open another line, or add a new line.

  5. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 16 Jan 2014 Link to this post

    Hi Ashraf,

    I have carefully examined the provided sample and after some debugging was able to find the cause of the problem. It seems that when the user clicks outside the grid the internal logic clears the currently edited row. This proves problematic as the when the OnBatchEditClosing event is canceled the row will stay in edit mode. Later when the user closes the window and clicks on the blank space RadGrid does not know which row to close.

    I have already logged this problem into our system and hope that our dev team will be able to provide a fix for it as soon as possible. You can monitor our progress on the matter from this link.

    As a token of gratitude for reporting this issue to us I have updated your Telerik points. Additionally please accept our apologies for any inconvenience this may have caused.

    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.
  6. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 16 Jan 2014 Link to this post

    Greetings and thanks for your reply.

    But I find it strange that the grid is able to close the line if I clicked on another line. It seems that this functionality doesn't depend on the currently edited row.

    I tried setting the private _currentlyEditedRow member of the BatchEditingManager object to the currently open row, and this resolves the problem.
  7. Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 21 Jan 2014 Link to this post

    Hi Ashraf,

    Actually in the particular case it closes the edited row because it has to open another for edit. Since only one editor is created for every column the editors change their position when another row is clicked.

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