@@ -67,6 +67,8 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
6767 this . row_cache = [ ] ;
6868
6969 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 ;
7072 this . hide_move_buttons = this . options . disable_array_reorder || this . jsoneditor . options . disable_array_reorder ;
7173 this . hide_add_button = this . options . disable_array_add || this . jsoneditor . options . disable_array_add ;
7274 } ,
@@ -393,8 +395,8 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
393395 else if ( this . value . length === 1 ) {
394396 this . remove_all_rows_button . style . display = 'none' ;
395397
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 ) {
398400 this . delete_last_row_button . style . display = 'none' ;
399401 }
400402 else {
@@ -403,13 +405,18 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
403405 }
404406 }
405407 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 ) {
408409 this . delete_last_row_button . style . display = 'none' ;
409- this . remove_all_rows_button . style . display = 'none' ;
410410 }
411411 else {
412412 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 {
413420 this . remove_all_rows_button . style . display = '' ;
414421 controls_needed = true ;
415422 }
0 commit comments