@@ -67,6 +67,8 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
67
67
this . row_cache = [ ] ;
68
68
69
69
this . hide_delete_buttons = this . options . disable_array_delete || this . jsoneditor . options . disable_array_delete ;
70
+ this . hide_delete_all_rows_buttons = this . hide_delete_buttons || this . options . disable_array_delete_all_rows || this . jsoneditor . options . disable_array_delete_all_rows ;
71
+ this . hide_delete_last_row_buttons = this . hide_delete_buttons || this . options . disable_array_delete_last_row || this . jsoneditor . options . disable_array_delete_last_row ;
70
72
this . hide_move_buttons = this . options . disable_array_reorder || this . jsoneditor . options . disable_array_reorder ;
71
73
this . hide_add_button = this . options . disable_array_add || this . jsoneditor . options . disable_array_add ;
72
74
} ,
@@ -393,8 +395,8 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
393
395
else if ( this . value . length === 1 ) {
394
396
this . remove_all_rows_button . style . display = 'none' ;
395
397
396
- // If there are minItems items in the array, hide the delete button beneath the rows
397
- if ( minItems || this . hide_delete_buttons ) {
398
+ // If there are minItems items in the array, or configured to hide the delete_last_row button, hide the delete button beneath the rows
399
+ if ( minItems || this . hide_delete_last_row_buttons ) {
398
400
this . delete_last_row_button . style . display = 'none' ;
399
401
}
400
402
else {
@@ -403,13 +405,18 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
403
405
}
404
406
}
405
407
else {
406
- // If there are minItems items in the array, hide the delete button beneath the rows
407
- if ( minItems || this . hide_delete_buttons ) {
408
+ if ( minItems || this . hide_delete_last_row_buttons ) {
408
409
this . delete_last_row_button . style . display = 'none' ;
409
- this . remove_all_rows_button . style . display = 'none' ;
410
410
}
411
411
else {
412
412
this . delete_last_row_button . style . display = '' ;
413
+ controls_needed = true ;
414
+ }
415
+
416
+ if ( minItems || this . hide_delete_all_rows_buttons ) {
417
+ this . remove_all_rows_button . style . display = 'none' ;
418
+ }
419
+ else {
413
420
this . remove_all_rows_button . style . display = '' ;
414
421
controls_needed = true ;
415
422
}
0 commit comments