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

[Solved] Self-Hierarchy

2 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daryl
Top achievements
Rank 1
Daryl asked on 16 Apr 2009, 06:21 PM
I have a grid on the page.  I've setup the Self-Hierarchy settings properly, binded the data, and everything works absolutely great!  I then wrote some code to remove the ExpandCollapseColum's and wrote some more code to place a custom button in the first column or each row that would allow me to expand and collapse.  I did this so all the columns in the nested table views match up with the master table view. Up to here, everything works fine.

Problem:  When I resize a column, only the Master Table view column resizes, but not the corresponsding column in the Nested Table view.  This behavior is technically correct.  Obviously I want the column in question in the master table and in all of the nested tables to resize together.  Is there a way to do this?  If so, how do I get this to work?

2 Answers, 1 is accepted

Sort by
0
Daryl
Top achievements
Rank 1
answered on 17 Apr 2009, 02:21 PM
can anyone help me with this problem?
0
Daryl
Top achievements
Rank 1
answered on 17 Apr 2009, 06:22 PM
well, I ended up solving my own problem.  Here's one solution...

Implement the following javascript funtion...

function ResizeAllColumns() { 
     
        // Get grid 
        var grid = $find("<%=AssignmentGrid.ClientID %>"); 
         
        // Get master table and all detail tables 
        var masterTableView = grid.get_masterTableView(); 
        var detailTables = grid.get_detailTables(); 
         
        // Get all columns 
        var arrayColumns = masterTableView.get_columns(); 
 
        // Traverse every table making columns equal 
        var width; 
        for (var i = 0; i < arrayColumns.length; i++) { 
         
            // Get master table column width 
            width = masterTableView.ColGroup.Cols[i].width; 
             
            for (var j = 0; j < detailTables.length; j++) { 
                // Set detail table column width 
                detailTables[j].ColGroup.Cols[i].width = width; 
            } 
        } 
 
        grid.width = 700; 
    } 

then add the following client settings to the RadGrid...

<ClientSettings> 
    <Resizing ResizeGridOnColumnResize="true" /> 
    <ClientEvents OnColumnResized="ResizeAllColumns" /> 
</ClientSettings> 

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