Thanks, Dennis
14 Answers, 1 is accepted
I'm afraid that hidden column feature is not currently available. However, you may get the data record for a particular row through Grid's dataItem method.
All the best,Rosen
the Telerik team

var
dataItem =
this
.dataSource.view()[
this
.select().index()];
alert(dataItem.name);
but how to get the id column, which the user wouldn't want to see?
FYI, I'm initializing the grid from an HTML table.
Thanks for any advice on this issue!
As one would expect, in order a field's data to be accessible through the DataSource, this data should be added to the DataSource. Therefore, you should verify that the field you are trying to access is rendered as column of the table element used to populated the Grid widget.
All the best,Rosen
the Telerik team

Thanks for this information. What I'm not understanding is how to access a field that's not shown in the Grid. For example, I don't want the database row ID shown to the user as a column, but need to access it. Does the Grid support this?
Thanks,
Pete
As I have mentioned in a previous message, dataItem method will return the entire data record available in the DataSource, not just the fields shown in the Grid's widget columns.
Maybe, in case you are continue to experiencing difficulties, you could provide a jsFiddle test page which demonstrates what you are trying to achieve
Rosen
the Telerik team

Here's how I did it: (I'm open for better solutions !!)
onChange: function (arg) { // This gets the HTML of the selected row ... var Row = this.select(); // This gives you a GUID string identifing the row in the HTML table var UID = Row.data("uid"); // This custom function return the model entity by comparing the GUID var Element = getElementByUID(UID, this.DataSource.view()); }
The function (which i placed in a common JS library file) look something like this:
getElementByUID = function (uid, dataSource) { var Index; for (Index = 0; Index < dataSource.length; Index++) { if (dataSource[Index].uid == uid) return dataSource[Index]; } };
Thanks,
Marc


In order to get a record from the DataSource you should use its getByUid method passing the UID or get method passing the record id (if such is defined).
onChange:
function
() {
var
record =
this
.dataSource.getByUid(
this
.select().data(
"uid"
));
}
Greetings,
Rosen
the Telerik team

change: function (arg) { var Entity = this.dataSource.getByUid(this.select().data("uid")); this.SelectedReportTypeID = Entity.ReportTypeID; }
How about multi-row selection ? I'm also trying to find all the selected UID in a grid ...
Thanks !
The UID is available in the Q1 2012 Beta and it is automatically added to the records as well as to Grid's row elements.
For multiple selection you will need to loop over the selected rows and get the data record as shown previously. However, note that if the item is shown in the grid current page you can use the Grid's dataItem method as described in my initial message.
Rosen
the Telerik team

var IDs = new Array(); this.select().each(function (index, element) { var Entity = dataSource.getByUid(element.dataset.uid); if (Entity) IDs.push(Entity.ID); }); return IDs;
Hope this can help somebody ... sure would have helped me !

It sure helped me. Once I found your entry.
Thanks for putting in the follow-up.
Andrew

var IDs = new Array(); this.select().each(function (index, element) { var Entity = dataSource.getByUid(element.dataset.uid); if (Entity) IDs.push(Entity.ID); }); return IDs;
It seems IE9 don't create a "dataset" array with every "data-" attributs it finds. Instead, use this :
var Entity = dataSource.getByUid(element.getAttribute("data-uid"));
I'm hoping this is the final solution. Maybe the next version of Kendo will support getting hidden data natively !