@ -146,6 +146,28 @@ function ItemSet(body, options) {
this . groupListeners = {
this . groupListeners = {
'add' : function ( event , params , senderId ) { // eslint-disable-line no-unused-vars
'add' : function ( event , params , senderId ) { // eslint-disable-line no-unused-vars
me . _onAddGroups ( params . items ) ;
me . _onAddGroups ( params . items ) ;
if ( me . groupsData && me . groupsData . length > 0 ) {
var groupsData = me . groupsData . getDataSet ( ) ;
groupsData . get ( ) . forEach ( function ( groupData ) {
if ( groupData . nestedGroups ) {
if ( groupData . showNested != false ) {
groupData . showNested = true ;
}
var updatedGroups = [ ] ;
groupData . nestedGroups . forEach ( function ( nestedGroupId ) {
var updatedNestedGroup = groupsData . get ( nestedGroupId ) ;
if ( ! updatedNestedGroup ) { return ; }
updatedNestedGroup . nestedInGroup = groupData . id ;
if ( groupData . showNested == false ) {
updatedNestedGroup . visible = false ;
}
updatedGroups = updatedGroups . concat ( updatedNestedGroup ) ;
} ) ;
groupsData . update ( updatedGroups , senderId ) ;
}
} ) ;
}
} ,
} ,
'update' : function ( event , params , senderId ) { // eslint-disable-line no-unused-vars
'update' : function ( event , params , senderId ) { // eslint-disable-line no-unused-vars
me . _onUpdateGroups ( params . items ) ;
me . _onUpdateGroups ( params . items ) ;
@ -1662,21 +1684,20 @@ ItemSet.prototype._onGroupClick = function (event) {
if ( ! group || ! group . nestedGroups ) return ;
if ( ! group || ! group . nestedGroups ) return ;
var groupsData = this . groupsData ;
if ( this . groupsData instanceof DataView ) {
groupsData = this . groupsData . getDataSet ( )
}
var groupsData = this . groupsData . getDataSet ( ) ;
group . showNested = ! group . showNested ;
var nestingGroup = groupsData . get ( group . groupId )
if ( nestingGroup . showNested == undefined ) { nestingGroup . showNested = true ; }
nestingGroup . showNested = ! nestingGroup . showNested ;
var nestedGroups = groupsData . get ( group . nestedGroups ) . map ( function ( nestedGroup ) {
var nestedGroups = groupsData . get ( group . nestedGroups ) . map ( function ( nestedGroup ) {
if ( nestedGroup . visible == undefined ) { nestedGroup . visible = true ; }
nestedGroup . visible = ! ! group . showNested ;
nestedGroup . visible = nestingGroup . showNested ;
return nestedGroup ;
return nestedGroup ;
} ) ;
} ) ;
groupsData . update ( nestedGroups ) ;
if ( group . showNested ) {
groupsData . update ( nestedGroups . concat ( nestingGroup ) ) ;
if ( nestingGroup . showNested ) {
util . removeClassName ( group . dom . label , 'collapsed' ) ;
util . removeClassName ( group . dom . label , 'collapsed' ) ;
util . addClassName ( group . dom . label , 'expanded' ) ;
util . addClassName ( group . dom . label , 'expanded' ) ;
} else {
} else {