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

[Solved] OnHierarchyExpanded Broken in Prometheus?

0 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
geekreef
Top achievements
Rank 1
geekreef asked on 08 Apr 2008, 03:51 AM
Hello All,
  I have been through the documentation as more times then i can count at this point. I found a nice tutorial on using a new radwindow to provide a server side argument through query strings here. And I have also been using the Hierarchical functionality of RadGrid in Prometheus demonstrated here.  In order to support a many to many relationship while using the Hierarchy Grid I am using the following code to overwrite the default Add New Record in the details table GridView.
<CommandItemTemplate> 
                               
                                                 <asp:LinkButton ID="btnEditSelected" runat="server" OnClientClick="myCreateRow()" ><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Edit.gif" />Associate Regulation With More Product Tests</asp:LinkButton> 
                             </CommandItemTemplate> 

 Using this code I can effectively pop open a new window, however I am having the hardest time figuring out how to reference the parent_rows selected index value which I currently believe I need in order to get the parentsID value. I have tried many iterations of the following code
 function myCreateRow() 
    {     
        alert("Trying Code"); 
         var oManager = GetRadWindowManager(); 
        var oGrid = $find("<%=RadGrid2.ClientID%>");         
        var firstDataItem = oGrid.get_detailTables()[0].get_parentRow().index; 
        alert(firstDataItem); 
        var cell = oGrid.get_masterTableView().getCellByColumnUniqueName(firstDataItem, "productID"); 
 
        alert(cell); 
      
        var oWnd = oManager.getWindowByName( "radAddRecord" ); 
        oWnd.setUrl( "popupRegtoProd.aspx?RegReqID=" + cell ); 
        oWnd.setSize(800, 400); 
        oWnd.show(); 
             
         
    } 
     

whatever is the required magic I can't seem to obtain the proper value from the productID column selected row.  Eventually I abandoned this approach and started trying to use the client events internal to Parent RadGrid in order to store the value for later use.

<ClientSettings> 
        <ClientEvents  OnHierarchyExpanding="HierarchyExpanding" /> 
</ClientSettings> 
 
 
function HierarchyExpanding(sender, eventArgs) 
 {  
     // alert("Row: " + eventArgs.get_itemIndexHierarchical() + " is being expanded"); 
     alert("attempting"); 
     var expandMe = eventArgs.get_itemIndexHierarchical() ; 
      
     $find("<%= RadGrid2.MasterTableView.ClientID %>").expandItem(expandMe); 
      
 } 

this is when I started to lose my nerve as for some reason the OnHierarchyExpanding has stoped working in Promethues!?  If I change the even to OnRowClick the event fires and I am able to get the row number that I need, however this event is not the OnHierarchyExpanding event which is the client side event that I need to make certain that I send the proper parentID to the new RadWindow.  On top of all the different routes listed above (believe me each one actually in this form post represents about 42 different iterations) I also tried changing the HierachyLoadMode around in the details GridView but that didn't seem to make any difference.  Does the matter in this case? Please help.... this is painful.  Hope someone knows how to fix this.  Thanks in advance for taking the time to read this. 

Wow at the end of all this I reread your post on hierachies and discovered that my problem was not using the HierarchyLoadMode="Client" in both the MasterTableView and the details table GridView.  Geez you guys are quick to respond, I got the answer before i even finshed my post.  If you are experiencing similar frustrations check out the post here. Again the magic is in the HierarchyLoadMode="client" on both the MasterTableView AND the detailstables GridView

Best, Andrew

No answers yet. Maybe you can help?

Tags
Grid
Asked by
geekreef
Top achievements
Rank 1
Share this question
or