@@ -41,6 +41,16 @@ Craft.SuperTableInputTable = Garnish.Base.extend({
41
41
42
42
for ( var i = 0 ; i < $rows . length ; i ++ ) {
43
43
new Craft . EditableTable . Row ( this , $rows [ i ] ) ;
44
+
45
+ var $block = $ ( $rows [ i ] ) ,
46
+ id = $block . data ( 'id' ) ;
47
+
48
+ // Is this a new block?
49
+ var newMatch = ( typeof id == 'string' && id . match ( / n e w ( \d + ) / ) ) ;
50
+
51
+ if ( newMatch && newMatch [ 1 ] > this . totalNewBlocks ) {
52
+ this . totalNewBlocks = parseInt ( newMatch [ 1 ] ) ;
53
+ }
44
54
}
45
55
46
56
this . updateAddBlockBtn ( ) ;
@@ -153,6 +163,16 @@ Craft.SuperTableInputRow = Garnish.Base.extend({
153
163
154
164
for ( var i = 0 ; i < this . $rows . length ; i ++ ) {
155
165
new Craft . SuperTableInputRow . Row ( this , this . $rows [ i ] ) ;
166
+
167
+ var $block = $ ( this . $rows [ i ] ) ,
168
+ id = $block . data ( 'id' ) ;
169
+
170
+ // Is this a new block?
171
+ var newMatch = ( typeof id == 'string' && id . match ( / n e w ( \d + ) / ) ) ;
172
+
173
+ if ( newMatch && newMatch [ 1 ] > this . totalNewBlocks ) {
174
+ this . totalNewBlocks = parseInt ( newMatch [ 1 ] ) ;
175
+ }
156
176
}
157
177
158
178
this . $addRowBtn = this . $divInner . next ( '.add' ) ;
@@ -178,7 +198,7 @@ Craft.SuperTableInputRow = Garnish.Base.extend({
178
198
179
199
var staticFieldStyle = ( this . settings . staticField ) ? 'style="display: none;"' : '' ;
180
200
181
- var html = '<div class="superTableRow">' +
201
+ var html = '<div class="superTableRow" data-id="' + id + '" >' +
182
202
'<input type="hidden" name="' + this . inputNamePrefix + '[' + id + '][type]" value="' + type + '">' +
183
203
'<table id="' + id + '" class="shadow-box editable superTable">' +
184
204
'<tbody>' +
0 commit comments