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

Disable javascript .Editable(editable => editable.Mode(GridEditMode.InCell))

2 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 08 Jul 2019, 10:24 PM

Hello.

I need to disable/enable a completely the way to edit my grid (batch mode).

Any suggestion to do it via javascript  on the .Editable(editable => editable.Mode(GridEditMode.InCell))?

            @(Html.Kendo().Grid<Haz.ViewModels.Exp.SommaireDetailExDRModel>()
                .Name("gridDetailsEx")
                .Columns(columns =>
                {
...
                })
                .ToolBar(toolBar =>
                {
                    toolBar.Create();
                    toolBar.Save();
                })
                .Editable(editable => editable.Mode(GridEditMode.InCell))
                .HtmlAttributes(new { style = "font-size:11px;height: 200px;" })
                .Scrollable()
                .Selectable(s => s.Enabled(true))
                .Sortable()
                .Resizable(s => s.Columns(true))
                .Filterable()
                .Pageable(pageable => pageable
                .Refresh(true)
                .ButtonCount(5))
                .Events(events => events
                       .Change("onChange").DataBound("onDataBound").Edit("onEdit").SaveChanges("onSaveChanges"))
...

 

Thanks to everyone.

2 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 10 Jul 2019, 02:15 PM
Hi Louis,

One way to achieve this is to prevent the BeforeEdit event handler on some condition.

e.g.

// attach event handler
 
.Events(x=> x.BeforeEdit(""onBeforeEdit))
 
// handler
 
function onBeforeEdit(e){
  if(...){ // add condition here   
      e.preventDefault();
   }
}


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Louis
Top achievements
Rank 1
Iron
Iron
Iron
answered on 10 Jul 2019, 08:59 PM
it's works  Georgi!  A big thank you.
Tags
Grid
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Georgi
Telerik team
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or