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

"Selectable()" attribute?

8 Answers 138 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.
Greg
Top achievements
Rank 1
Greg asked on 01 Sep 2011, 02:14 PM
Is there an example of turning on/off client-side row selection in the ASP.Net MVC Grid? Other than the selecting to another grid example. I would also like to know if it supports multi-row selection.

8 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Sep 2011, 02:26 PM
Hi Greg,

 Currently the MVC grid does not support multi-row selection. You can disable selection only server side like this:

.Selectable(settings => settings.Enabled(false))


Regards,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Greg
Top achievements
Rank 1
answered on 01 Sep 2011, 02:39 PM
No dice. :(

I get the following error every time I added that property to the grid: "The DataKeys collection is empty. Please specify a data key."


Here's a snippet of code from my test project:

<%: Html.Telerik().Grid(Model) _
    .Name("Orders") _
    .Columns(Function(columns)
                 columns.Bound(Function(o) o.OrderID)
                 columns.Bound(Function(o) o.ShipAddress)
                 columns.Bound(Function(o) o.RequiredDate)
             End Function) _
    .Pageable() _
    .Sortable() _
    .Selectable(Function(s)
                    s.Enabled(True)
                End Function) _
    .ClientEvents(Function(events)
                      events.OnRowSelect("onRowSelected")
                  End Function)
%>
0
Atanas Korchev
Telerik team
answered on 01 Sep 2011, 02:42 PM
Hi Greg,

As the exception says you need to define a datakey in order to enable grid selection:

.DataKeys(Sub (keys) keys.Add(Function(o) o.OrderID) End Sub)

All the best,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Greg
Top achievements
Rank 1
answered on 01 Sep 2011, 02:50 PM
Wow, you guys are fast. Wish our other providers were half as fast.

Ok, on to question number two. Does the grid support multiple row selection?

Does the grid support hierarchical grids (aka nested grids)?
0
Atanas Korchev
Telerik team
answered on 01 Sep 2011, 03:02 PM
Hello Greg,

 No, multiple row selection is not supported. Perhaps you can use checkboxes instead?

 Yes, nested grids are supported. Please check this example.

All the best,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Greg
Top achievements
Rank 1
answered on 01 Sep 2011, 03:08 PM
Thanks!

Hmm, I'm not sure checkboxes will fly or not. I'll see how it turns out.

A couple more questions for you.

Can you hide columns pre-display? What I mean is can I include a column in the list of columns but set it's visibility to hidden in the grid definition? If so can you still access the hidden column(s) values on client-side events?

Can I override a column's value at runtime? We have several columns which contain integer values to represent enums. We'd like to be able to turn the integer values into something more meaningful like a imagine with mouse-over text.
0
Atanas Korchev
Telerik team
answered on 01 Sep 2011, 03:20 PM
Hi Greg,

 You can either make columns Hidden() or use the dataItem JavaScript method to retrieve column values on the client-side. If you decide to use hidden columns make them appear last in the column list. IE has problems with hidden table columns when they are not last.

You can change the display of the column using templates. Please check the client and server template examples.

All the best,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Greg
Top achievements
Rank 1
answered on 01 Sep 2011, 03:25 PM
Thanks again.
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Greg
Top achievements
Rank 1
Share this question
or