using the edit/delete buttons with custom action

8 posts, 0 answers
  1. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 10 Apr 2013 Link to this post

    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
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2272 posts

    Posted 11 Apr 2013 Link to this post

    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!
  3. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 12 Apr 2013 Link to this post

    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,
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2272 posts

    Posted 12 Apr 2013 Link to this post

    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!
  5. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 15 Apr 2013 Link to this post

    Ok,thank you for the informations.
  6. Max
    Max avatar
    3 posts
    Member since:
    Oct 2012

    Posted 04 Jul 2013 Link to this post

    How to do this with javascript? Without MVC.

    Thanks.
  7. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2272 posts

    Posted 08 Jul 2013 Link to this post

    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!
  8. Max
    Max avatar
    3 posts
    Member since:
    Oct 2012

    Posted 23 Aug 2013 Link to this post

    Yes it works, thanks.
Back to Top