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

[Solved] DoubleClick To Expand GridRow

5 Answers 323 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh K
Top achievements
Rank 1
Suresh K asked on 11 Aug 2009, 06:39 AM
Hi.,

Can i know how to Expand the row When i DoubleClick On the RadGrid  "SelectedRow"

Thank you

5 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Aug 2009, 07:07 AM
Hello Suresh,

Checkout the code library which demonstrates how to expand/collapse grid items in hierarchical grid on row double-click. You can modify the code by checking whether the row is selected before expanding/collapsing in RowDblClicked event, if you want to perform expanding/collapsing only if the row is selected.

Also checkout the following code library which uses another approach (ajaxRequest) to expand/collapse hierarchy on row double-clicking.
Expand/collapse hierarchy with ajax request on double click

Thanks,
Princy.
0
Suresh K
Top achievements
Rank 1
answered on 11 Aug 2009, 01:21 PM
Hi.
Thank you for your response.
it works fine.But i want the functionality to
Hierarchy with Templates
(http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx)
 it's not working to Hierarchy with Templates
can u tell me how to do for this grid
I am Binding Data Programatically(Radgrid1_Need DataSource),not using datasource


0
Suresh K
Top achievements
Rank 1
answered on 14 Sep 2009, 10:46 AM
Hi.,
can i know how to Expand only one row at a time.
Suppose if already any rows expanded i want to Collapse that rows and i want to Expand Which row is clicked.,
i did use this code to Expand And Collapse the rows.,It's working Fine.
Now i want to Expan only the Double Clicked row and remaining rows will be collapse.
Can u Please Help me.,

i did use the HierarchyExpandCollapseOnDoubleClickWithAjax.Zip Example Code.

Thank you.

0
Princy
Top achievements
Rank 2
answered on 14 Sep 2009, 11:12 AM
Hello Suresh,

You can refer to the following documentation inorder to implement single row expand at a time for each level in the grid hierarchy:
Single expand in hierarchical grid

Hope this gets you going...
Princy :)
0
Suresh K
Top achievements
Rank 1
answered on 14 Sep 2009, 12:55 PM
hi.,
Thank you for your response.
already i did this.,
It's  working when we click on ExpandCollapse button.
But when we double Click on the Row It's not calling that RadGrid1_ItemCommand Event.
  is there any way.
is it possible to do in JavaScript.

I am Using This JavaScript:

 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
            <script type="text/javascript"
            var imageButtonPath = null
             
            function RowDblClicked(sender, eventArgs) 
            { 
            var radgrd1 
                var grid = sender;               
                var rowIndex = eventArgs.get_itemIndexHierarchical(); 
                if(rowIndex.indexOf(':') != -1) 
                { //alert(rowIndex) 
                    rowIndexrowIndex = rowIndex.substr(rowIndex.lastIndexOf('_') + 1); 
                   // alert(rowIndex) 
                } 
                var tableView = eventArgs.get_tableView(); 
                var row = tableView.get_dataItems()[rowIndex];   
                if(tableView.getCellByColumnUniqueName(row, "ExpandColumn")) 
                {    
                  if(row.get_expanded() == false) 
                    { 
                        row.set_expanded(true);                  
                        imageButton = tableView.getCellByColumnUniqueName(row, "ExpandColumn").childNodes[0]; 
                        imageButton.className = "rgCollapse"
//                       radgrd1= $find("<%= RadGrid1.ClientID %>") 
//                        alert(radgrd1.ClientID) 
                        
                    } 
                    else 
                    { 
                        row.set_expanded(false); 
                        imageButton = tableView.getCellByColumnUniqueName(row, "ExpandColumn").childNodes[0]; 
                        imageButton.className = "rgExpand"
                    }      
                }       
            } 
            </script> 
            </telerik:RadCodeBlock> 
Tags
Grid
Asked by
Suresh K
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Suresh K
Top achievements
Rank 1
Share this question
or