@@ -110,9 +110,9 @@ Collection.prototype.add = function(item, suppressevent) {
110110 // if ( !(suppressevent === true) )
111111 // this.events.inserted.notify(m);
112112
113- $ ( '#' + m . uid ) . off ( 'click contextmenu' )
114- . on ( 'click' , m , this . on_item_click )
115- . on ( 'contextmenu' , m , this . on_item_ctxmenu ) ;
113+ // $('#' + m.uid).off('click contextmenu')
114+ // .on('click', m, this.on_item_click)
115+ // .on('contextmenu', m, this.on_item_ctxmenu);
116116 }
117117
118118 if ( item instanceof Array ) {
@@ -121,13 +121,23 @@ Collection.prototype.add = function(item, suppressevent) {
121121 _add_model ( i , true ) ;
122122 } ) ;
123123
124- if ( ! ( suppressevent === true ) )
125- this . events . inserted . notify ( items ) ;
124+ // if ( !(suppressevent === true) )
125+ this . events . inserted . notify ( items ) ;
126+
127+ items . forEach ( i => {
128+ $ ( '#' + i . uid ) . off ( 'click contextmenu' )
129+ . on ( 'click' , i , this . on_item_click )
130+ . on ( 'contextmenu' , i , this . on_item_ctxmenu ) ;
131+ } ) ;
126132 } else {
127133 _add_model ( item )
128134
129- if ( ! ( suppressevent === true ) )
130- this . events . inserted . notify ( item ) ;
135+ // if ( !(suppressevent === true) )
136+ this . events . inserted . notify ( item ) ;
137+
138+ $ ( '#' + item . uid ) . off ( 'click contextmenu' )
139+ . on ( 'click' , item , this . on_item_click )
140+ . on ( 'contextmenu' , item , this . on_item_ctxmenu ) ;
131141 }
132142} ;
133143
0 commit comments