@@ -232,6 +232,29 @@ class Container extends BaseContainer {
232232 }
233233 }
234234
235+ /**
236+ * Triggered after the store config got changed
237+ * @param {Number } value
238+ * @param {Number } oldValue
239+ * @protected
240+ */
241+ afterSetStore ( value , oldValue ) {
242+ let me = this ,
243+ listeners = {
244+ filter : me . onStoreFilter ,
245+ load : me . onStoreLoad ,
246+ scope : me
247+ } ;
248+
249+ value ?. on ( listeners ) ;
250+ oldValue ?. un ( listeners ) ;
251+
252+ // in case we dynamically change the store, the view needs to get the new reference
253+ if ( me . view ) {
254+ me . view . store = value
255+ }
256+ }
257+
235258 /**
236259 * Triggered after the useCustomScrollbars config got changed
237260 * @param {Boolean } value
@@ -293,35 +316,13 @@ class Container extends BaseContainer {
293316
294317 /**
295318 * Triggered before the store config gets changed.
296- * @param {Neo.data.Store } value
297- * @param {Neo.data.Store } oldValue
319+ * @param {Object| Neo.data.Store|null } value
320+ * @param {Neo.data.Store } oldValue
298321 * @protected
299322 */
300323 beforeSetStore ( value , oldValue ) {
301- oldValue ?. destroy ( ) ;
302-
303324 if ( value ) {
304- let me = this ,
305-
306- listeners = {
307- filter : me . onStoreFilter ,
308- load : me . onStoreLoad ,
309- recordChange : me . onStoreRecordChange ,
310- scope : me
311- } ;
312-
313- if ( value instanceof Store ) {
314- value . on ( listeners )
315- } else {
316- value = ClassSystemUtil . beforeSetInstance ( value , Store , {
317- listeners
318- } )
319- }
320-
321- // in case we dynamically change the store, the view needs to get the new reference
322- if ( me . view ) {
323- me . view . store = value
324- }
325+ value = ClassSystemUtil . beforeSetInstance ( value , Store )
325326 }
326327
327328 return value
@@ -404,19 +405,6 @@ class Container extends BaseContainer {
404405 return columns
405406 }
406407
407- /**
408- *
409- */
410- createViewData ( ) {
411- let me = this ;
412-
413- me . view . createViewData ( ) ;
414-
415- if ( me . useCustomScrollbars && me . scrollbarsCssApplied === false ) {
416- me . applyCustomScrollbarsCss ( )
417- }
418- }
419-
420408 /**
421409 * @override
422410 * @returns {* }
@@ -458,50 +446,29 @@ class Container extends BaseContainer {
458446
459447 me . store . sort ( opts ) ;
460448 me . removeSortingCss ( opts . property ) ;
461- me . onStoreLoad ( me . store . items )
449+ opts . direction && me . view . onStoreLoad ( )
462450 }
463451
464452 /**
465453 *
466454 */
467455 onStoreFilter ( ) {
468- this . onStoreLoad ( this . store . items )
456+ this . onStoreLoad ( )
469457 }
470458
471459 /**
472- * @param {Object[] } data
473460 * @protected
474461 */
475- onStoreLoad ( data ) {
462+ onStoreLoad ( ) {
476463 let me = this ;
477464
478- if ( me . rendered ) {
479- me . createViewData ( ) ;
480-
481- if ( me . store . sorters . length < 1 ) {
482- me . removeSortingCss ( )
483- }
484- } else {
485- me . on ( 'rendered' , ( ) => {
486- me . timeout ( 50 ) . then ( ( ) => {
487- me . createViewData ( )
488- } )
489- } , me , { once : true } )
465+ if ( me . useCustomScrollbars && me . scrollbarsCssApplied === false ) {
466+ me . applyCustomScrollbarsCss ( )
490467 }
491- }
492468
493- /**
494- * Gets triggered after changing the value of a record field.
495- * E.g. myRecord.foo = 'bar';
496- * @param {Object } opts
497- * @param {String } opts.field The name of the field which got changed
498- * @param {Neo.data.Model } opts.model The model instance of the changed record
499- * @param {* } opts.oldValue
500- * @param {Object } opts.record
501- * @param {* } opts.value
502- */
503- onStoreRecordChange ( opts ) {
504- this . view . onStoreRecordChange ( opts )
469+ if ( me . store . sorters ?. length < 1 ) {
470+ me . removeSortingCss ( )
471+ }
505472 }
506473
507474 /**
0 commit comments