@@ -141,19 +141,13 @@ define([
141
141
* @returns {Object } Chainable.
142
142
*/
143
143
initElements : function ( data ) {
144
- var newData = this . getNewData ( data ) ,
145
- recordIndex ;
144
+ var newData = this . getNewData ( data ) ;
146
145
147
146
this . parsePagesData ( data ) ;
148
147
149
148
if ( newData . length ) {
150
149
if ( this . insertData ( ) . length ) {
151
- recordIndex = data . length - newData . length - 1 ;
152
- if ( ! isNaN ( recordIndex ) ) {
153
- _ . each ( newData , function ( newRecord ) {
154
- this . processingAddChild ( newRecord , ++ recordIndex , newRecord [ this . identificationProperty ] ) ;
155
- } , this ) ;
156
- }
150
+ this . parseProcessingAddChild ( data , newData ) ;
157
151
}
158
152
}
159
153
@@ -182,6 +176,22 @@ define([
182
176
this . reload ( ) ;
183
177
}
184
178
} , this ) ;
179
+ } ,
180
+
181
+ /**
182
+ * Processing add child if the record index is not a number.
183
+ *
184
+ * @param {Array } data
185
+ * @param {Array } newData
186
+ */
187
+ parseProcessingAddChild : function ( data , newData ) {
188
+ let recordIndex ;
189
+ recordIndex = data . length - newData . length - 1 ;
190
+ if ( ! isNaN ( recordIndex ) ) {
191
+ _ . each ( newData , function ( newRecord ) {
192
+ this . processingAddChild ( newRecord , ++ recordIndex , newRecord [ this . identificationProperty ] ) ;
193
+ } , this ) ;
194
+ }
185
195
}
186
196
} ) ;
187
197
} ) ;
0 commit comments