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

Populate GridClientSelectColumn with OnRowDataBound javascript function

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gang Xue
Top achievements
Rank 1
Gang Xue asked on 19 Feb 2009, 07:22 PM
Hi, I am using OnRowDataBound client event handler to add new items to the Grid on the client side. However, I found that the GridClientSelectColumn is not populated, i.e. no check box appears, when a new item is added to the table view. So the question is how can I get the check box to appear? My wild guess is I might have to edit the innerHTML of the cell, but not sure at all.

Thanks for helping.

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 23 Feb 2009, 03:04 PM

Hi Gang Xue,

You are correct, that's exactly the way to add the checkbox when adding a new item on the client.

Here is the code for that:

            function Grid_RowDataBound(sender,args)  
            {  
                  
                var table = $find("RadGrid1").get_masterTableView();  
                var item = args.get_item();  
                  
                if (item._itemIndexHierarchical >=  table.get_pageSize() - 1)  
                    table.getCellByColumnUniqueName(item,"SelectColumn").innerHTML = "<input type='checkbox' id='SelectColumnSelectCheckBox'/>";  
            }   

Do note that you have to add the checkbox only if the page size is exceeded when the new item is added. In addition, the checkbox has to have an ID that ends with SelectCheckBox, in this way it will be an itegral part of the grid row. And finally, SelectColumn is (in my example) the unique name of the GridClientSelectColumn.

Hope this helps. 

 

 

 

Best Regards,

Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Gang Xue
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or