简体   繁体   中英

Make option as unclickable in multi dropdown using jquery

If I add some options and save it, after reloading the page it should be shown in dropdown and it should be unclickable. I use the ("#OpsLead_taglist").prop("disabled", true) , value is not showing in the dropdown list. Otherwise it is not making readonly. As per criteria it should be readonly and can add new lists in that dropdown. Kindly suggest me. I can't handle this. 在此处输入图片说明

Source Code:

var opsmultiselect = $("#OpsLead").data("kendoMultiSelect");
$(this).attr("disabled", true);//not working

If you want to prevent some items from being deselected you could do this by decorating them with a css-class and let the eventlistener decide whether to prevent the deselection or not.

function onDeselect(e){ 
  if($(e.item).hasClass("k-state-disabled")) {
    e.preventDefault(); 
  }
}

You can use something like this:

//To make it readonly
$("#OpsLead").data("kendoMultiSelect").readonly(true);

//To make it editable again
$("#OpsLead").data("kendoMultiSelect").readonly(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM