@@ -141,19 +141,13 @@ define([
141141 * @returns {Object } Chainable.
142142 */
143143 initElements : function ( data ) {
144- var newData = this . getNewData ( data ) ,
145- recordIndex ;
144+ var newData = this . getNewData ( data ) ;
146145
147146 this . parsePagesData ( data ) ;
148147
149148 if ( newData . length ) {
150149 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 ) ;
157151 }
158152 }
159153
@@ -182,6 +176,22 @@ define([
182176 this . reload ( ) ;
183177 }
184178 } , 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+ }
185195 }
186196 } ) ;
187197} ) ;
0 commit comments