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

How to get the dataitem ?

4 Answers 245 Views
Grid
This is a migrated thread and some comments may be shown as answers.
abhilash
Top achievements
Rank 1
abhilash asked on 27 May 2010, 03:10 PM

I an using serverside binding for the grid. When I am trying to get the dataItem on the client side it is null. Do you have an example how to get the dataitem on the client side when we are using server side binding ?

This is what I am doing to get the dataitem from the client side. But the dataitem is null.

 

 

var manageContainersId = EHProcessingGrid.get_masterTableView().get_selectedItems()[0]._dataItem.LabelId;

 

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 May 2010, 06:45 AM

Hello Abhilash,

You could use the following client side code in order to access the dataitem.

Client code:

 
    function getSelected() {  
        var grid = $find("<%=RadGrid1.ClientID %>");  
        var mastertableView = grid.get_masterTableView();  
        var row = mastertableView.get_selectedItems()[0];  
        // Your code  
    } 

-Shinu.

0
Daniel
Telerik team
answered on 28 May 2010, 06:19 PM
Hello Abhilash,

You can access the data item when using client-side binding. In your scenario you could get the cell text instead:
$find("RadGrid1").get_masterTableView().get_selectedItems()[0].get_cell("MyColumn").innerHTML;

Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
abhilash
Top achievements
Rank 1
answered on 28 May 2010, 06:34 PM

Thanks. Is there anyway to get the whole dataitem instead of a cell ?

This is how I am getting the cell.

 

 

 

for (var i = 0; i < Grid.get_masterTableView().get_selectedItems().length; i++) {   
   var row = selectedRows[i];   
   var cell = Grid.get_masterTableView().getCellByColumnUniqueName(row, "Id");  
   var Id = cell.outerText;   
}  
 
 
0
Daniel
Telerik team
answered on 01 Jun 2010, 09:59 PM
Hello Abhilash,

You could get either the datakey values or the cell contents when using server-side binding.

Extracting key values client-side


Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
abhilash
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
abhilash
Top achievements
Rank 1
Share this question
or