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

[Solved] dataItem returns null

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christopher Ronak
Top achievements
Rank 1
Christopher Ronak asked on 20 Apr 2012, 05:47 PM
Hello, in version 2011.3.1115 of the telerik grid, if the server returns a fully populated grid then on the client side doing a tGrid.dataItem() seems to always return null.  Checking the release notes of the April release we did not see a note about this issue and were wondering if this was a known issue.  (Clicking refresh on the client will resolve the issue but seems silly since the grid should already have the data on initialize)

On the server we would be doing something like

<%= Html.Telerik().Grid(Model.Items)
             ....

%>

And on the client we would be doing something like

var tGrid = $('#Grid').data("tGrid");
return tGrid.dataItem($('#Grid tr.t-state-selected'));


1 Answer, 1 is accepted

Sort by
0
Pechka
Top achievements
Rank 1
answered on 21 Apr 2012, 07:13 AM
Yo

<%= Html.Telerik().Grid(Model.Items)


Exactly this codes causes the behavior you described. Because when the Grid is bound on the server there are no JavaScript objects representing your collection.
Let the Grid gets its data with an Ajax call if you want to have tGrid.dataItem() to return something.
Tags
Grid
Asked by
Christopher Ronak
Top achievements
Rank 1
Answers by
Pechka
Top achievements
Rank 1
Share this question
or