【问题标题】:Adding an id to kendo grid editor popup向剑道网格编辑器弹出窗口添加 id
【发布时间】:2020-03-26 15:08:36
【问题描述】:

我有一个带有可编辑弹出窗口的剑道网格。我在同一页面上有一个单独的弹出窗口,用于显示其他内容。当我单击按钮加载单独的剑道窗口时,会弹出网格中的编辑器窗口。我怎么能阻止它?我可以在剑道网格编辑器窗口中添加一个 id 以立即关闭它还是在 javascript 中有某种方法可以

.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();
}

我整天都在绞尽脑汁,我已经全力以赴。我不知道还能做什么。

【问题讨论】:

    标签: model-view-controller kendo-ui window kendo-grid


    【解决方案1】:

    一种可能性是关闭剑道网格中的编辑,然后创建一个模板列并在其中添加您自己的编辑按钮并创建您自己的编辑模式(从行中传递 ID 或您需要的任何信息)。

    您可以做的另一件事是利用编辑前事件。在这里,只要你有一些条件来判断你是否真的想要打开编辑器,如果条件不满足,你就可以关闭它。

    将此添加到您的 mvc 网格代码中:

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

    然后创建你的javascript函数:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-04
      • 1970-01-01
      • 2015-11-28
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      • 2013-07-06
      • 1970-01-01
      相关资源
      最近更新 更多