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

How to select a cell client side?

1 Answer 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 2
Daniel asked on 27 Apr 2015, 09:34 AM

Hi there,

How can I select a cell by using Javascript? I found a method to clear all selected cells but it seems there is not way to select / deselect a single cell on client side.

Please can you help me?

Thank you and regards,
Dan

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 30 Apr 2015, 10:30 AM
Hello Daniel,

Once you get reference to a particular cell element you can use the private _cellSelection.select(cell) method of the grid to select that cell:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function pageLoad() {
            var grid = $find("<%=RadGrid1.ClientID%>");
            var tableView = grid.get_masterTableView();
            var someCell = tableView.get_dataItems()[0].get_element().cells[0];
            grid._cellSelection.select(someCell);
        }
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource">
    <ClientSettings>
        <Selecting CellSelectionMode="MultiCell" />
    </ClientSettings>
</telerik:RadGrid>

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Daniel
Top achievements
Rank 2
Answers by
Konstantin Dikov
Telerik team
Share this question
or