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

using the edit/delete buttons with custom action

7 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 10 Apr 2013, 08:47 AM
Hello,
it is possible to use the edit and delete buttons,but to put my own action,a javascript function,when i click on them?
i want to use them,because they already have their style(image and color) ,OR to create custom buttons just like the edit/delete buttons,with my own handler when i click on them.

Regards,
Daniel

7 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 11 Apr 2013, 12:46 PM
Hello Daniel,


To achieve this you could define a custom command
E.g.
columns.Command(command => command.Custom("commandName").Click("handlerName"));

and on dataBound attach the classes, that are used for the edit/delete icon.
E.g.
function dataBound(){
    $(".k-grid-commandName span").addClass("k-icon k-edit");
}

 

All the best,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 12 Apr 2013, 01:22 PM
but if i do not put nothing a text for the custom command,something like this .Custom(" ")
than how can i call that class?because sometimes i want to use for space reasons only the button with its icon.

regards,
0
Dimiter Madjarov
Telerik team
answered on 12 Apr 2013, 01:43 PM
Hello Daniel,


In the current scenario the default class of the custom command would be .k-grid- . We are currently working on providing a way to assign a custom class to custom commands.

Wish you a great day!

 

Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 15 Apr 2013, 06:52 AM
Ok,thank you for the informations.
0
Max
Top achievements
Rank 1
answered on 04 Jul 2013, 01:23 PM
How to do this with javascript? Without MVC.

Thanks.
0
Dimiter Madjarov
Telerik team
answered on 08 Jul 2013, 06:29 AM
Hello Ali,


The approach when using the Kendo UI Web Grid is basically the same.

You should define the custom command
{ command: {name: "commandName", text: "View Details", click: showDetails }, title: " " }

And then add the icon in the dataBound event handler
function dataBound(){
    $(".k-grid-commandName span").addClass("k-icon k-edit");
}

Please let me know if this was the information that you were looking for. I wish you a great day!

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Max
Top achievements
Rank 1
answered on 23 Aug 2013, 06:39 AM
Yes it works, thanks.
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Daniel
Top achievements
Rank 1
Max
Top achievements
Rank 1
Share this question
or