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

create grid with CRUD inside custom command

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Harya
Top achievements
Rank 1
Harya asked on 02 Oct 2017, 04:56 AM

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 

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 04 Oct 2017, 06:05 AM
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.
Tags
Grid
Asked by
Harya
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or