Hi,
I think i found a solution to this problem. Solution : when you reach the maximum selection s- i am disabling all other options which are not selected,and when you uncheck an option - they will get enabled again
Below is my code. If you think this causes any issue - please let me know.
$sel.pqSelect({
checkbox: true,
multiplePlaceholder: 'Select/Unselect columns',
maxDisplay: 100,
width: 'auto',
maxSelect: 20, maxDisplay: 0,
displayText: "Select/Unselect Columns",
//deselect: false,
search: true,
}).on("pqselectmaxselectreach", function (event, ui) {
$("label[id^=pq-option]").find('input:not(:checked)').attr('disabled', 'disabled');
})
.on("change", function (event) {
var length = 20;
if ($(this).find("option:selected").length < length) {
$("label[id^=pq-option]").find('input[type="checkbox"]').removeAttr('disabled');
}
});
Thanks!