You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Lists with the multiPicker.
Everything worked fine unless I started to implement an edit-function within my application.
I tried to auto-select the Options (li items) with the prePopulate option. $("#alarmdays").multiPicker({ selector : "li", prePopulate : data.data.days });
Works ok for me, but when some of the Elements are already active, they'll be unselected by this function, also it doesn't clear the past selection so I may end up with a mess.
I could not find a simple "Unselect()" function in the documentation.
My workaround right now is to delete the value of the hidden field and remove the "active" classes from the options by:
If there already are functions like this, im sorry.
Otherwise it would be a great improvement.
EDIT:
Actually the "prePopulate" doesn't work for me, as I can't change the selection afterwards.
I created these two handy helper functions:
// -- Helper to unselect a list
function unselect(list) {
$('input[name='+list+']').val('');
$("#"+list).children().removeClass('active');
}
// -- Helper to select options in a list
function select(list, elements) {
$("#"+list+" li").each(function( index ) {
if($.inArray( index, elements ) >= 0) {
$( this ).click();
}
});
}
The text was updated successfully, but these errors were encountered:
Hey,
I'm using Lists with the multiPicker.
Everything worked fine unless I started to implement an edit-function within my application.
I tried to auto-select the Options (li items) with the prePopulate option.
$("#alarmdays").multiPicker({ selector : "li", prePopulate : data.data.days });
Works ok for me, but when some of the Elements are already active, they'll be unselected by this function, also it doesn't clear the past selection so I may end up with a mess.
I could not find a simple "Unselect()" function in the documentation.
My workaround right now is to delete the value of the hidden field and remove the "active" classes from the options by:
If there already are functions like this, im sorry.
Otherwise it would be a great improvement.
EDIT:
Actually the "prePopulate" doesn't work for me, as I can't change the selection afterwards.
I created these two handy helper functions:
The text was updated successfully, but these errors were encountered: