-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
I ask for adding some Trigger like:
function appendValues(data) {
$.each(data, function(i, datum) {
self.add(datum);
});
self.checkLimit();
$el.trigger('afterAppend');/* or other name trigger */
}
Idem for the add function before and after. just to make your code more flexible :-)
I need this trigger because when I start your code, I have always 1 list-item empty after adding data in the selective function:
$('.grid').find('.my_list').selective({
preventDuplicates: true,
add: true,
addKeyCodes: [ 13 ],
source: adminurl.ajax+"?action=get_list_competence_words",
data: ['eat','sleep']
});
the source return:
[{"label":"eat","value":"eat"},{"label":"sleep","value":"sleep"},[0,"apprendre"],[1,"eat"],[2,"sleep"],[3,"run"],[4,"walk"]]
the final result:
"eat"
"sleep"
""
With the trigger, I can remove the last value after loading result using:
$('.grid').find('.my_list').bind('afterAppend',function(){
$(this).find('a.list-group-item').each(function (){
if($(this).data('label') == "")
$(this).remove();
});
});
Or something like that.
Thanks ;-) 👍