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

How to enable Delete functionality only without any edit functionality in the Grid ?

1 Answer 299 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ayyappan
Top achievements
Rank 1
Ayyappan asked on 10 Dec 2012, 08:39 AM
Hi,

I have a Grid whose data source is an javascript array of objects. How to enable Deletion alone in this Grid ? When I add "destroy" and say "editable" as True then it is allowing editing of cells also. I do not want editing of cells.

Also the alert to delete repeats itself and the row is not getting deleted in the javascript array. Any reason why ?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 11 Dec 2012, 09:15 AM
Hello Ayyappan,

I have already replied to your questions in the support thread that you submitted on the same subject. For convenience I will paste my reply here so the other users who have the same question would be able to read it.

I am afraid that the delete functionality cannot be enabled alone because it is part of the editing. If you would like to use only the deleting without giving the user opportunity to edit cells you could use one of the following approaches:
  • Set the grid to editable: "inline" and include only a "destroy" command. In this way the user will not be able to enter in edit mode through the UI, but it would be still possible to enter in edit mode through the API methods.
  • In case it a must to use a batch editing mode, please define the grid as editable: true and disable the editing of the fields in the model.
    fields: {
        foo: { type: "string", editable: false }
    }

Regarding your second question. The grid's data is not bound to the original JavaScript array this is why any changed performed to this data will not affect on the initial array. In case you need to retrieve the grid data you can do that with the data method.
Copy Code
$("#grid").data("kendoGrid").dataSource.data();

Alternatively you may bind the Grid to the array via MVVM.

I hope the information will help. To avoid further duplication I would like to ask you to continue our conversation in only one of the threads.
Thank you in advance for the understanding.

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!
Tags
Grid
Asked by
Ayyappan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or