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

[Solved] grouping disables clientside row selection

1 Answer 31 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.
Jonam
Top achievements
Rank 1
Jonam asked on 27 May 2012, 09:28 AM
Hello,

I have a grid and i bind a clientside event to the rowselect event. This gets the value of the first invisible column. Works fine but when i group the grid the first column is empty. I guess the grouping puts a column infront of it. Is there a work around this problem?

 

 

@(Html.Telerik().Grid<

 

CaseLawViewModel>()

.DataBinding(dataBinding => dataBinding.Ajax().Select(

 

"List", "Caselaw"))

.Name(

 

"Grid")

.Sortable(sorting => sorting

.SortMode(

 

 

 

 

 

GridSortMode.MultipleColumn))

.ClientEvents(events => events.OnRowSelected(

 

 

 

 

 

"onRowSelect"))

.Filterable()

.Selectable()

.Groupable()

.Scrollable(p => p.Enabled(

 

 

 

 

 

true).Height(600))

.Columns(columns =>

{

columns.Bound(o => o.Id).Hidden(

 

 

 

 

 

true);

columns.Bound(o => o.Number).Width(200);

columns.Bound(o => o.CaseLawDate).Format(

 

 

 

 

 

"{0:d}");

columns.Bound(o => o.Court);

columns.Bound(o => o.Parties);

columns.Bound(o => o.Articles);

columns.Bound(o => o.Keywords);

columns.Bound(o => o.Id).ClientTemplate(

 

 

 

 

 

"<a href='/CaseLaw/Details/<#= Id #>'>details</a>").Title("Action");

}))

 

 

 

 

function onRowSelect(e) {

 

var row = e.row;

selectedId = row.cells[0].innerHTML;

}

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 30 May 2012, 02:13 PM
Hi Jonam,

You can easily work around this by assigning a class to your column:
.HtmlAttributes(new { @class="myClass"});
and then use it when you want to find that cell in the row:
function onRowSelect(e){
    alert($('.myClass',e.row).text())
}


Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Jonam
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or