create grid with CRUD inside custom command

2 posts, 0 answers
  1. Harya
    Harya avatar
    5 posts
    Member since:
    Sep 2017

    Posted 01 Oct 2017 Link to this post

    hello,

    it is possible to create grid with crud inside custom command ?, ( http://demos.telerik.com/aspnet-mvc/grid/custom-command )

    if yes , can you show me example for the code ? ,

    if not , can you show me something similiar ?

     

    thanks :D 

  2. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1009 posts

    Posted 04 Oct 2017 Link to this post

    Hi, Harya,

    To add custom edit and delete buttons, you may follow the syntax in the referenced demo. It includes a click handler function name, for example, customEdit:

    columns.Command(command => command.Custom("CustomEdit").Click("customEdit")).Width(180);
     
    <script>
      function cunstomEdit(){
        e.preventDefault();
        var row = $(e.target).closest("tr");
        grid.editRow(row);
      }
    </script>

    As long as the Kendo UI Grid data source is configured for CRUD operations, the API methods to use are:

    - editRow: http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-editRow
    - removeRow: http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-removeRow
    - addRow: http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-addRow

    To get the grid instance, use the Name() of the grid in MVC. Kendo UI will create a div element with an id, equal to the name.

    Here is a runnable example I created for your convenience:

    http://dojo.telerik.com/@bubblemaster/uZaRIh

    Let me know if you need further help.

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top