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

Hierarchy Grid data retrieval

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 1
Jacques asked on 04 Nov 2008, 05:19 PM
Need some information on how to retrieve row data from a hieracal grid (client side). Each row in the grid contains a checkbox. Whenever a checkbox is modified, I need to retrieve the checked/unchecked status and the Parent and child ID's.

Currently have an onclick event for the checkbox. this allows me to retrieve the state of the checkbox,but I'm unable to get any additional information from the row the checkbox is located.

Also attempted to retrieve the information using the RowClicked event. and using the get_itemIndexHierarchal() function. It only works for the top level item and throws an error for the rest.

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
    <script type="text/javascript">  
        //Process the click event of a checkbox. When a parent is checked all children should be checked  
        //When a parent is unchecked, no action need be taken.  
        //When a child is unchecked, the parent must be unchecked  
        function processAccessCheckBox(item) {  
 
            var grid = $find("<%= rgPermission.ClientID %>");  
            var gridgridSelectedItems = grid.get_masterTableView().get_selectedItems();  
            alert(gridSelectedItems.count);  
            //get all detail tables in the hierarchy  
            var detailTablesArray = grid.get_detailTables();  
 
            if (item.checked) {  
                alert(item.checked);  
                //var ParentID = detailTablesArray[0].  
                //Check all child items  
                //Check if detail table is a child  
            }  
            else {  
                alert(item.checked);  
                //Uncheck parent item  
                //var parentRow = get_parentView 
            }  
            alert(detailTablesArray.length);  
            return false;  
        }  
 
 
        function RowClick(sender, eventArgs) {  
            var MTV = eventArgs.get_tableView();  
            var cbCol = MTV.getCellByColumnUniqueName(MTV.get_dataItems()[eventArgs.get_itemIndexHierarchical()], "Access");  
            var text = "";  
            text += "col content: ";  
            text += cbCol.innerHTML  
            //text += ", Index: " + eventArgs.get_itemIndexHierarchical();  
            //document.getElementById("OutPut").innerHTML = text;  
            alert(text);  
        }  
 
    </script> 
</telerik:RadScriptBlock> 
 

Any help on retrieving data (client side) from a Hierarchal grid will be appreciated.

Thanks

Jacques

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 07 Nov 2008, 09:10 AM
Hi Jacques,

The following sample contains additional information on the requested setup.
I hope this gets you started properly.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jacques
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or