kendo ui multiselect删除删除操作 [英] kendo ui multiselect remove delete action

查看:435
本文介绍了kendo ui multiselect删除删除操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何限制用户删除多选"小部件中已保存的项目.用户应该不能删除现有值,但可以添加或删除新值.

How can i restrict users from deleting the already saved items in the Multi select widget. Users should not be able to delete existing values but can add or remove the new values.

我尝试的解决方案是在数据绑定上删除删除图标,如下所示.它会被删除,但在调用执行数据绑定方法后会返回.

The solution i tried was on databound remove the delete icon like below. It gets deleted but comes back after the call executes the databound method.

有什么想法吗?

onDataBound: function (e) {
        e.preventDefault();
        $(e.sender.tagList).find("li span.k-delete").remove();
    }

这是视图中的代码,该代码在数据绑定上调用上述js函数

This is the code in the view which calls the above js function on databound

 @(Html.Kendo().MultiSelectFor(x => x.Documents)
                      .DataTextField("Description")
                      .DataValueField("Code")
                      .Placeholder("Select Attachment...")
                      .AutoBind(false)
                      .DataSource(source => source.Read(read => read.Action("GetCustomerDocuments", "CustomerRequest")).ServerFiltering(true))
                      .HtmlAttributes(new {style = "width:400px;"}) 
                      .Events(e => e.DataBound("onDataBound"))                            
                      )  

推荐答案

您是否尝试过在change事件上应用与数据绑定事件上相同的方法?

Have your tried applying the same method on the change event as on the databound event?

剃刀:

.Events(e => e.Change("onChange"))

Javascript:

onChange: function (e) {
    e.preventDefault();
    $(e.sender.tagList).find("li span.k-delete").remove();
}

这篇关于kendo ui multiselect删除删除操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆