@@ -156,7 +156,7 @@ define([
156
156
dnd : '${ $.dndConfig.name }'
157
157
} ,
158
158
pages : 1 ,
159
- pageSize : 20 ,
159
+ pageSize : 2 ,
160
160
relatedData : [ ] ,
161
161
currentPage : 1 ,
162
162
recordDataCache : [ ] ,
@@ -167,8 +167,7 @@ define([
167
167
* Sets record data to cache
168
168
*/
169
169
setRecordDataToCache : function ( data ) {
170
- this . recordDataCache = this . recordDataCache && data . length > this . recordDataCache . length ?
171
- data : this . recordDataCache ;
170
+ this . recordDataCache = data ;
172
171
} ,
173
172
174
173
/**
@@ -625,6 +624,19 @@ define([
625
624
this . pages ( pages ) ;
626
625
} ,
627
626
627
+ /**
628
+ * Reinit record data in order to remove deleted values
629
+ *
630
+ * @return void
631
+ */
632
+ reinitRecordData : function ( ) {
633
+ this . recordData (
634
+ _ . filter ( this . recordData ( ) , function ( elem ) {
635
+ return elem && elem [ this . deleteProperty ] !== this . deleteValue ;
636
+ } , this )
637
+ ) ;
638
+ } ,
639
+
628
640
/**
629
641
* Get items to rendering on current page
630
642
*
@@ -827,8 +839,7 @@ define([
827
839
deleteRecord : function ( index , recordId ) {
828
840
var recordInstance ,
829
841
lastRecord ,
830
- recordsData ,
831
- childs ;
842
+ recordsData ;
832
843
833
844
if ( this . deleteProperty ) {
834
845
recordInstance = _ . find ( this . elems ( ) , function ( elem ) {
@@ -840,11 +851,8 @@ define([
840
851
this . removeMaxPosition ( ) ;
841
852
this . recordData ( ) [ recordInstance . index ] [ this . deleteProperty ] = this . deleteValue ;
842
853
this . recordData . valueHasMutated ( ) ;
843
- childs = this . getChildItems ( ) ;
844
-
845
- if ( childs . length > this . elems ( ) . length ) {
846
- this . addChild ( false , childs [ childs . length - 1 ] [ this . identificationProperty ] , false ) ;
847
- }
854
+ this . reinitRecordData ( ) ;
855
+ this . reload ( ) ;
848
856
} else {
849
857
this . update = true ;
850
858
0 commit comments