How to disable checkbox for certain values in multiselect dropdown

I am trying to disable checkbox for certain values in multiselect dropdown.I have tried below link and modified the source code but it's not working.pleasse check attached source code and advise how to resolve this issue.

https://www.syncfusion.com/forums/157795/is-it-possible-to-disable-checkbox-for-certain-values-in-multiselect-dropdown

Note:-

I would like to disable checked item value when popup is opened.




Attachment: MultiSelect_db088249.zip

1 Reply

PM Ponmani Murugaiyan Syncfusion Team July 7, 2021 11:10 AM UTC

Hi Hassan, 

Thanks for contacting Syncfusion support. 

We have modified the sample as per your requirement to disable the selected items when open the popup. Please find the code snippet and sample below for reference. 

window.OnPopupOpen = (id, MultiselectValue) => { 
    setTimeout(function (e) { 
    var instances = document.getElementById(id); 
    var LIElement = instances.blazor__instance.popupObj && instances.blazor__instance.popupObj.element.getElementsByClassName('e-list-item'); 
    var LICount = LIElement.length; 
    for (var item = 0; item < LICount; item++) { 
        var value = LIElement[item].getAttribute('data-value'); 
        if (MultiselectValue && (MultiselectValue.length > 0) && MultiselectValue.includes(value)) { 
            LIElement[item].classList.add('e-disabled'); 
        } 
        } 
    }, 100) 
} 

Output

 


Kindly check with the above sample to achieve your requirement. Please get back us if you need further assistance. 

Regards, 
Ponmani M 


Loader.
Up arrow icon