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

How to add multiple command buttons in the same column?

6 Answers 3147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohit
Top achievements
Rank 1
Mohit asked on 27 Feb 2013, 07:19 PM
I want to add multiple command buttons (let's say, for View, Edit and Print) in a single grid column so that I see them for each row.
I was also able to add icon to custom command and I was able to easily add one command button in one column as explained in the custom command demo but I really want all three "buttons/icons" in the same column.

Any suggestions?

6 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 28 Feb 2013, 01:47 PM
Hello Mohit,

You can add multiple commands in one column by defining columns.command property as array. As an example:
columns: [
    { field: "foo", title: "Foo Field" },
    {
        command: [
            //define the commands here
            { name: "edit", text: "Edit" },
            { name: "destroy", text: "Delete"},
            { name: "custom1", text: "MyCustom-1" },
            { name: "custom2", text: "MyCustom-2" }
        ],
        title: "Commands"
    }
],

I hope this will help.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mohit
Top achievements
Rank 1
answered on 28 Feb 2013, 06:00 PM
Alexander, can this also be done via the grid html helper (for razor)?
0
Accepted
Alexander Valchev
Telerik team
answered on 01 Mar 2013, 01:07 PM
Hello Mohit,

Yes it can be done.
.Columns(columns => {
    columns.Bound(e => e.FirstName);
    columns.Bound(e => e.LastName);
    columns.Bound(e => e.Title);
    columns.Command(command => {
        command.Custom("viewDetails").Click("showDetails");
        command.Custom("AnotherCommand").Text("Another Command");
        command.Custom("Custom").Text("Custom Command");
    });
})


Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mohit
Top achievements
Rank 1
answered on 31 May 2013, 12:09 AM
Ah, works perfectly. Thanks Alexander!
0
Andrew
Top achievements
Rank 1
answered on 17 Jun 2013, 06:02 PM
Is there a way to do this at the grid level so you could have multiple "Add New Item" buttons for instance?
0
Alexander Valchev
Telerik team
answered on 19 Jun 2013, 10:42 AM
Hello Andrew,

Having "add new item" button on each row does not make much sense. Usually the edit/delete commands are rendered per row because they indicate row editing/deleting.

Anyway, if you insist to have a multiple "add" buttons, you may define a custom command and on click to call the addRow method.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Mohit
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Mohit
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or