1
0
Fork 0

[DEV-3192] Fix hiding the header when all contents are hidden

master
Jeffrey Fisher 2018-06-12 13:50:41 -04:00
parent 8ac2a367db
commit 345e570e67
2 changed files with 53 additions and 2 deletions

View File

@ -792,7 +792,7 @@ module.exports = Class( 'GroupUi' )
},
'public hideField': function( field, index )
'virtual public hideField': function( field, index )
{
if ( this.isFieldVisible( field, index ) === false )
{
@ -814,7 +814,13 @@ module.exports = Class( 'GroupUi' )
},
'public showField': function( field, index )
'protected hasVisibleField'( index )
{
return this._visCount[ index ] > 0 ? true : false;
},
'virtual public showField': function( field, index )
{
if ( this.isFieldVisible( field, index ) === true )
{

View File

@ -100,4 +100,49 @@ module.exports = Class( 'StackedGroupUi' )
return this.__super( index );
},
/**
* Hide the header if there are no visible fields
*
* @param field
* @param index
*/
'public override hideField'( field, index )
{
this.__super( field, index );
if ( !this.hasVisibleField( index ) )
{
const header = this._$container.find( 'dl' )[ index ];
var attribute = header.getAttribute( 'class' );
attribute = attribute.includes( ' hidden ' ) ? attribute : attribute + ' hidden ';
header.setAttribute( 'class', attribute );
}
},
/**
* Show the header if there are visible fields
*
* @param field
* @param index
*/
'public override showField'( field, index )
{
this.__super( field, index );
if ( this.hasVisibleField( index ) )
{
const header = this._$container.find( 'dl' )[ index ];
var attribute = header.getAttribute( 'class' );
attribute = attribute.includes( ' hidden ' ) ? attribute.replace(' hidden ', '') : attribute;
header.setAttribute( 'class', attribute );
}
}
} );