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

[Solved] dataItem is in EditMode on client-side?

3 Answers 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 19 Jun 2008, 01:42 PM
Hi there,

I would like to be able to query if a dataItem or a row is in EditMode on the client-side in JavaScript on the RadGrid (using the Q1 2008 Ajax RadControls.)

I want to know this because I want to be able to set an item into EditMode if a user clicks on the row. At the moment I am solving this by putting the following code into the "ClientEvents-OnRowClick" event:

        var dataItem = $get(args.get_id());
        var anchorHref = dataItem.getElementsByTagName("a")[0].href;
  
        if (anchorHref.indexOf("EditButton") > 0)
            eval(anchorHref);


However, this seems like a real hack to me and is dependant on there being an Edit anchor element when not in editmode. Also I doubt this will work once I've "Ajaxified" my grid?

Thanks in advance,
 - Nick

3 Answers, 1 is accepted

Sort by
0
Nick
Top achievements
Rank 1
answered on 19 Jun 2008, 03:25 PM
I found the answer to my own problem!

The code I needed was:

        var masterTable = $find("<%=DeterminandsEntryGrid.ClientID %>").get_masterTableView();
        masterTable.fireCommand("Edit", args.get_itemIndexHierarchical());

This page: http://www.telerik.com/help/aspnet-ajax/grid_firecommand.html had the info I needed.

 - Nick
0
Nick
Top achievements
Rank 1
answered on 19 Jun 2008, 03:31 PM
Actually I just realised this only answers half my question: how to neatly call the edit command.

I still don't know how to find out if the dataitem or row is in editmode?

Anyone know?
0
Rosen
Telerik team
answered on 23 Jun 2008, 03:52 PM
Hi Nick,

In order to accomplish the desired scenario you may consider building an array of edited item's indexes on the server than send it to the client. I have attached a simple implementation of such an approach.

Kind regards,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Nick
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or