0
votes

I have kendo grid with an editable popup window. I have a separate popup window for something else, on the same page. When I click a button to load the separate kendo window, the editor window in the grid pops up. How can I stop that? can I add an id to the kendo grid editor window to close it immediately or is there some way in javascript that I can

.ToolBar(toolbar =>
{
    toolbar.Create().Text("Add New Default Setting Group");
})
.Editable(editable => editable
.Mode(Kendo.Mvc.UI.GridEditMode.PopUp)
.TemplateName("DefaultSettings_Edit")
.Window(w => w.Title("Default Setting Management"))
)
.Selectable(s =>
 {
     s.Enabled(true);
     s.Mode(GridSelectionMode.Single);
     s.Type(GridSelectionType.Row);
 })

function UpdateDefaultSetting(id)
{
    $("#settingwindow").data("kendoWindow").title('Update Default Setting');
    $('#SettingID').val(id);
    //Maybe close it here?
    $("#settingwindow").data("kendoWindow").open();
    $("#settingwindow").data("kendoWindow").center();
}

I've been wracking my brain all day and I'm all out. I don't know what else to do.

1

1 Answers

0
votes

One possibility is to turn off editing in the kendo grid, then create a template column and add your own edit button to that and create your own editing modal (passing in the Id or whatever information you need from the row).

Another thing you could do is take advantage of the before edit event. Here, so long as you have some condition to tell whether or not you actually want the editor to open, you could close it out if the condition isn't met.

Add this to your mvc grid code:

.Events(events => events
    .BeforeEdit("onBeforeEdit")
)

Then create your javascript function:

function onBeforeEdit(e){
   if(condition where I don't the editor to open)
   e.preventDefault();
}