@@ -160,6 +160,9 @@ define([
160
160
startIndex : 0
161
161
} ,
162
162
163
+ /**
164
+ * Sets record data to cache
165
+ */
163
166
setRecordDataToCache : function ( data ) {
164
167
this . recordDataCache = this . recordDataCache && data . length > this . recordDataCache . length ?
165
168
data : this . recordDataCache ;
@@ -177,7 +180,9 @@ define([
177
180
'processingDeleteRecord' ,
178
181
'onChildrenUpdate' ,
179
182
'checkDefaultState' ,
180
- 'renderColumnsHeader'
183
+ 'renderColumnsHeader' ,
184
+ 'deleteHandler' ,
185
+ 'setDefaultState'
181
186
) ;
182
187
183
188
this . _super ( )
@@ -247,15 +252,9 @@ define([
247
252
initElement : function ( elem ) {
248
253
this . _super ( ) ;
249
254
elem . on ( {
250
- 'deleteRecord' : function ( index , id ) {
251
- this . deleteHandler ( index , id ) ;
252
- } . bind ( this ) ,
253
- 'update' : function ( state ) {
254
- this . onChildrenUpdate ( state ) ;
255
- } . bind ( this ) ,
256
- 'addChild' : function ( ) {
257
- this . setDefaultState ( ) ;
258
- } . bind ( this )
255
+ 'deleteRecord' : this . deleteHandler ,
256
+ 'update' : this . onChildrenUpdate ,
257
+ 'addChild' : this . setDefaultState
259
258
} ) ;
260
259
261
260
return this ;
@@ -270,7 +269,8 @@ define([
270
269
deleteHandler : function ( index , id ) {
271
270
this . setDefaultState ( ) ;
272
271
this . processingDeleteRecord ( index , id ) ;
273
- this . pagesChanged [ this . currentPage ( ) ] = ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
272
+ this . pagesChanged [ this . currentPage ( ) ] =
273
+ ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
274
274
this . changed ( _ . some ( this . pagesChanged ) ) ;
275
275
} ,
276
276
@@ -307,19 +307,20 @@ define([
307
307
changed . forEach ( function ( elem ) {
308
308
changedElemDataScope = elem . dataScope . split ( '.' ) ;
309
309
changedElemDataScope . splice ( 0 , dataScope . length ) ;
310
- changedElemDataScope [ 0 ] = ( parseInt ( changedElemDataScope [ 0 ] , 10 ) - this . pageSize * ( this . currentPage ( ) - 1 ) ) . toString ( ) ;
311
- this . setValueByPath ( this . defaultPagesState [ this . currentPage ( ) ] , changedElemDataScope , elem . initialValue ) ;
310
+ changedElemDataScope [ 0 ] =
311
+ ( parseInt ( changedElemDataScope [ 0 ] , 10 ) - this . pageSize * ( this . currentPage ( ) - 1 ) ) . toString ( ) ;
312
+ this . setValueByPath (
313
+ this . defaultPagesState [ this . currentPage ( ) ] ,
314
+ changedElemDataScope , elem . initialValue
315
+ ) ;
312
316
} , this ) ;
313
317
}
314
318
315
- this . pagesChanged [ this . currentPage ( ) ] = ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
319
+ this . pagesChanged [ this . currentPage ( ) ] =
320
+ ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
316
321
this . changed ( _ . some ( this . pagesChanged ) ) ;
317
322
} ,
318
323
319
- compare : function ( a1 , a2 ) {
320
- return compareArrays ( a1 , a2 )
321
- } ,
322
-
323
324
/**
324
325
* Set default dynamic-rows state
325
326
*
@@ -426,10 +427,12 @@ define([
426
427
return initialize ;
427
428
} ) ) ;
428
429
429
- this . pagesChanged [ this . currentPage ( ) ] = ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
430
+ this . pagesChanged [ this . currentPage ( ) ] =
431
+ ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
430
432
this . changed ( _ . some ( this . pagesChanged ) ) ;
431
433
} else if ( this . hasInitialPagesState [ this . currentPage ( ) ] ) {
432
- this . pagesChanged [ this . currentPage ( ) ] = ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
434
+ this . pagesChanged [ this . currentPage ( ) ] =
435
+ ! compareArrays ( this . defaultPagesState [ this . currentPage ( ) ] , this . arrayFilter ( this . getChildItems ( ) ) ) ;
433
436
this . changed ( _ . some ( this . pagesChanged ) ) ;
434
437
}
435
438
} ,
@@ -438,6 +441,7 @@ define([
438
441
* Filters out deleted items from array
439
442
*
440
443
* @param {Array } data
444
+ *
441
445
* @returns {Array } filtered array
442
446
*/
443
447
arrayFilter : function ( data ) {
0 commit comments