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

Context Menu

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohamed Salah Al-Din
Top achievements
Rank 1
Mohamed Salah Al-Din asked on 03 Oct 2010, 01:26 PM

Refering to the demo:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandmenu/defaultcs.aspx?product=grid

and using the Hierarchical data feature of RadGrid, I am trying to have context menu on the master and the details, but i wasn't able to get the selected index and the selected ID.

function CarModel_RowContextMenu(sender, eventArgs) {
                var menu = $find('UC_Splitter_CarModel_List_Content_CarModel_RadContextMenu');
                var evt = eventArgs.get_domEvent();
  
                if (evt.target.tagName == "INPUT" || evt.target.tagName == "A") {
                    return;
                }
  
                if (eventArgs.get_tableView().get_name() == "Models") {
                    alert('child');
                    //get the selected datakey value
                    //
                    //
                }
                else {
                    var index = eventArgs.get_itemIndexHierarchical();
                    var key = sender.get_masterTableView().get_dataItems()[index].getDataKeyValue("ID");
                    CarModelSetKeyValue(index, key);
  
                    sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);
  
                    menu.show(evt);
  
                    evt.cancelBubble = true;
                    evt.returnValue = false;
  
                    if (evt.stopPropagation) {
                        evt.stopPropagation();
                        evt.preventDefault();
                    }
                }
            }


please i need help in this issue urgently.

3 Answers, 1 is accepted

Sort by
0
Mohamed Salah Al-Din
Top achievements
Rank 1
answered on 03 Oct 2010, 01:52 PM
i can find the index using this function:

var index_str = eventArgs.get_itemIndexHierarchical();
var index = index_str.split(":")[1].split("_")[1];

but also i am not able to select the row in the child grid or to get the DataKeyValue from it
0
Mohamed Salah Al-Din
Top achievements
Rank 1
answered on 06 Oct 2010, 08:39 AM
Unfortunately, I did not receive replies until now.
0
Tsvetina
Telerik team
answered on 07 Oct 2010, 08:02 AM
Hi Mohamed,

I am attaching a sample project implementing the functionality described by you - a three-level hierarchical RadGrid using context menu in both master and detail tableviews. You just need to customize the commands if you want to use the menu for another purposes. 

Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Mohamed Salah Al-Din
Top achievements
Rank 1
Answers by
Mohamed Salah Al-Din
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or