Hi,
I am using Asp.Net MVC 3 and Infragistic Grid.
Out of the columns I am showing in grid, first one is Hyerlink (used column template)
@(Html
.Infragistics().Grid<SearchSummary>(Model.SearchResults.AsQueryable()).ID("wbGrid")
.Columns( col => { col.For(x => x.ID).HeaderText("ID").Template("<a id='lnkSummaryID' href='${ID}'>${ID}</a>");
col.For(x => x.Name).HeaderText("Name");
col.For(x => x.Date).HeaderText("Created Date"); })
.Features(features => { features.Selection().Mode(SelectionMode.Row).MultipleSelection(false).Activation(true); })
.Height("400px").DataBind().Width("800px").Render())
Now when the hyperlink (ID in first column) is clicked, I want row data. I am hooking a click event to hyperlink
$("#lnkSummaryID").live('click', function () {
var row = $('#wbGrid').igGridSelection('selectedRow');
});
Here row variable has innerText that gives me concatenated values of all columns corresponding to the selected row.
Can I get individual columns of the row using some king of index or column name ????
Got the answer. Below is the code for accessing a single column:
var rows = $('#wbGrid').igGridSelection('selectedRow');
var dataview = $('#wbGrid').data('igGrid').dataSource.dataView();
var cellRowId = dataview[rows.element[0].rowIndex]["SummaryID"];