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

Custom commands at a group level

1 Answer 246 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 21 Mar 2014, 02:03 PM
Hi, 

I've just purchased the ASP.Net MVC Kendo UI Grid and I am looking to do the following:-

I have a dataset which in the redacted code below is grouped by RegionalManager like this:-

    .DataSource(dataSource => dataSource
            .Ajax()
            .Group(grp => grp.Add(m => m.RegionalManager ))
            .ServerOperation(false)
            .Batch(true) // enable batch updates


What I would like to be able to do is somehow add a command at the group level so I could swap the regional manager for an entire grouping.
At the moment, I am only able to add custom commands at the whole grid or row level.

Any help would be much appreciated.




1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 25 Mar 2014, 10:28 AM
Hello Alex, 

Although adding a command button on a group level is currently not supported out of the box, it could be achieved using a custom solution. For example:
  1. Use a ClientGroupHeaderTemplate that displays a button that has a certain class: 
    columns.Bound(p => p.RegionalManager ).ClientGroupHeaderTemplate("Regional Manager : #=value# <a href='\\#' groupID='#=value#' class='k-button group-edit '>Click me</a> ");
  2. Attach a click event handler to this class: 
    <script>
        $("body").on("click", ".group-edit", function (e) {
            alert($(e.target).attr("groupID"));
        });


Regards,
Alexander Popov
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or