I have a picklist, based on a checkbox, I wanted to restrict the picklist selection. I wanted to remove those items from the targetList or restrict it being populated there.
$("#source-catalogue").pickList({
sourceListLabel : "Source Catalogue",
targetListLabel : "Source Fields",
addAllLabel : "â–ºI",
addLabel : "â–º",
removeAllLabel : "Iâ—„",
removeLabel : "â—„",
sortItems : false,
beforeAdd: function(){
if(ConfigGlobals.reOrderFlag){
tmpList = $('#source-container ul.pickList_targetList li');
alert("Please uncheck mycheckbox and then try");
}
},
afterAdd: function(){
if(ConfigGlobals.reOrderFlag){
curLen = $('#source-container ul.pickList_targetList li').length
diff = curLen - tmpList.length
// remove the selection
}
},
I have done this as below.
On the afterAdd callback, for each item, i have added these calls.
This removed the item from selection and added back to the list.