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

Edit on RowDblClick have strange behavior

4 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 10 Jul 2012, 02:20 PM
Hi,

there is a strange behavior that I can't understand when I DoubleClick on a row.

Here is my javacript function that handle the RowDblClick:

var editedRowIndex;
function RowDblClick(sender, eventArgs)
{
    var gridMPA = $find("<%= gridMPA.ClientID %>");
    var editedRow;
     
    if (editedRowIndex)
    {
        editedRow = gridMPA.get_masterTableView().get_dataItems()[editedRowIndex];
        if (editedRow.get_isInEditMode())
        {
            gridMPA.get_masterTableView().updateItem(editedRow.get_itemIndexHierarchical());
        }
    }
    editedRowIndex = eventArgs.get_itemIndexHierarchical();
    gridMPA.get_masterTableView().editItem(editedRowIndex);
}

If you look at it, is seems to works and it does, but only in chrome debug. If I just run it normally, the editedRow doesn't get updated, but if I run it in debug using Chrome debug and execute line per line, it works. So why this is happenning?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Jul 2012, 12:53 PM
Hi Jocelyn,

Try the following Javascript to make a RadGrid in Editmode
JS:
<script type="text/javascript">
 function RowDblClick(sender, eventArgs)
 {
   editedRow = eventArgs.get_itemIndexHierarchical();
   $find("<%= RadGrid1.MasterTableView.ClientID %>").editItem(editedRow);
 }
</script>

Thanks,
Shinu
0
Jocelyn
Top achievements
Rank 1
answered on 12 Jul 2012, 01:58 PM
Hi Shinu,

this isn't working for me.

I think I wasn't clear enough in my previous post.

I edited my RowDblClick a little bit:

function RowDblClick(sender, eventArgs)
{
    var masterTable = $find("<%= gridMPA.MasterTableView.ClientID %>");
     
    if (editedRow != undefined)
    {
        masterTable.updateItem(editedRow);
    }
    editedRow = eventArgs.get_itemIndexHierarchical();
    masterTable.editItem(editedRow);
}

I double click on an item, I enter some value in the editmode. I click on another item and it update the previous one and put the other one in editmode. This only works on the first item I edit. After that, if I click on a new item, it will just close the previous edited item and put the new one in editmode. But if I go in debug using Chrome and go step by step, the item will get updated...

This is like the server don't have enough time to update the previous item before the new one get in editmode...
0
Jocelyn
Top achievements
Rank 1
answered on 12 Jul 2012, 02:01 PM
I just published on a IIS server and it seems to work. I only get this strange behavior in VS Debug.
0
Andrey
Telerik team
answered on 13 Jul 2012, 10:59 AM
Hi,

It is really strange indeed. Could you share your complete page source code along with the code-behind file content? Thus all the people who want to help you will have better understanding of your case.

I am looking forward your reply.

Regards,
Andrey
the Telerik team
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 their blog feed now.
Tags
Grid
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jocelyn
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or