Browse Source

unselectAll

unknown 5 years ago
parent
commit
3704c34632

+ 19 - 1
o2web/source/x_component_Selector/Identity.js

@@ -696,6 +696,12 @@ MWF.xApplication.Selector.Identity.Item = new Class({
             selectedItem[0].addItem(this);
             this.selectedItem = selectedItem[0];
             this.setSelected();
+
+            var flag = this.selector.options.selectAllRange === "all" ||
+                ( this.selector.selectType == "identity" && ( this.selector.options.showSelectedCount || this.selector.options.isCheckStatus ));
+            if( flag ){
+                if(this.category && this.category._addSelectedCount )this.category._addSelectedCount( 1, true );
+            }
         }
     }
 });
@@ -782,7 +788,9 @@ MWF.xApplication.Selector.Identity.ItemSelected = new Class({
                 items.each(function(item){
                     item.selectedItem = this;
                     item.setSelected();
-                    if( this.selector.selectType == "identity" && ( this.selector.options.showSelectedCount || this.selector.options.isCheckStatus ) ){
+                    var flag = this.selector.options.selectAllRange === "all" ||
+                        ( this.selector.selectType == "identity" && ( this.selector.options.showSelectedCount || this.selector.options.isCheckStatus ) );
+                    if( flag ){
                         if(item.category && item.category._addSelectedCount )item.category._addSelectedCount( 1, true );
                     }
                 }.bind(this));
@@ -831,7 +839,17 @@ MWF.xApplication.Selector.Identity.ItemCategory = new Class({
                 }
                 this.selectAllNode.setStyles( styles );
             }
+        }else if( count === 0 && this.selector.options.selectAllRange === "all" && this.selectAllNode ){
+            styles = this.selector.css.selectorItemCategoryActionNode_selectAll;
+            this.isSelectedSome = false;
+            this.isSelectedAll = false;
+            this.selectAllNode.setStyles( styles );
+        }
+
+        if( !this.selectedCountNode1 ){
+            this.selectedCountNode1 = new Element("span").inject(this.textNode);
         }
+        this.selectedCountNode1.set("text",count);
     },
     _getShowName: function(){
         // if( this._getTotalCount && this._getSelectedCount ){

+ 13 - 4
o2web/source/x_component_Selector/Person.js

@@ -1963,6 +1963,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
         });
     },
     clickItem: function( callback, checkValid ){
+        debugger;
         // if ( layout.mobile && this.selector.options.count.toInt()===1){
         //     this.selectedSingle( checkValid );
         // }else{
@@ -2089,6 +2090,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
         }
     },
     unSelected: function( checkValid, callback ){
+        var isSelected = this.isSelected;
         this.isSelected = false;
         if( this.node ){
             this.node.setStyles(this.selector.css.selectorItem);
@@ -2102,7 +2104,7 @@ MWF.xApplication.Selector.Person.Item = new Class({
             }
         }
 
-        if( this.category ){
+        if( this.category && this.selector.options.selectAllRange !== "all" ){
             this.category.checkUnselectAll();
         }
 
@@ -2131,10 +2133,20 @@ MWF.xApplication.Selector.Person.Item = new Class({
             }.bind(this))
         }
 
+        debugger;
+
         if (this.selectedItem){
             this.selector.selectedItems.erase(this.selectedItem);
 
             this.selectedItem.items.each(function(item){
+                if( item.isSelected || ( item === this && isSelected ) ){
+                    var flag = this.selector.options.selectAllRange === "all" ||
+                        ( this.selector.selectType == "identity" && ( this.selector.options.showSelectedCount || this.selector.options.isCheckStatus ));
+                    if( flag ){
+                        if(item.category && item.category._addSelectedCount )item.category._addSelectedCount( -1, true );
+                    }
+                }
+
                 if (item != this){
                     item.isSelected = false;
                     item.node.setStyles(this.selector.css.selectorItem);
@@ -2147,9 +2159,6 @@ MWF.xApplication.Selector.Person.Item = new Class({
                         item.actionNode.setStyles( this.selector.css.selectorItemActionNode_single );
                     }
                 }
-                if( this.selector.selectType == "identity" && ( this.selector.options.showSelectedCount || this.selector.options.isCheckStatus ) ){
-                    if(item.category && item.category._addSelectedCount )item.category._addSelectedCount( -1, true );
-                }
             }.bind(this));
 
             this.selectedItem.destroy();

+ 8 - 0
o2web/source/x_component_Selector/UnitWithType.js

@@ -204,6 +204,8 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
             ( this.data.woSubDirectUnitList || [] ).each(function(subData){
                 if( !this.selector.isExcluded( subData ) ) {
                     if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType) !== -1) {
+
+                        debugger;
                         var unit = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this);
                         this.selector.items.push( unit );
                         if( !this.subItems )this.subItems = [];
@@ -257,6 +259,8 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
             this.data.woSubDirectUnitList.each(function(subData){
                 if( !this.selector.isExcluded( subData ) ) {
                     if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType) !== -1) {
+
+                        debugger;
                         var unit = this.selector._newItem(subData, this.selector, this.children, this.level + 1, this, true);
                         unit.justItem = true;
                         unit.load();
@@ -314,6 +318,8 @@ MWF.xApplication.Selector.UnitWithType.ItemCategory = new Class({
             this.data.woSubDirectUnitList.each(function(subData){
                 if( !this.selector.isExcluded( subData ) ) {
                     if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType)!==-1){
+
+                        debugger;
                         var unit = this.selector._newItem(subData, this.selector, this.children, this.level+1, this);
                         if(this.subItems)this.subItems.push( unit );
                     }else{
@@ -391,6 +397,8 @@ MWF.xApplication.Selector.UnitWithType.ItemCategory = new Class({
             this.data.woSubDirectUnitList.each(function(subData){
                 if( !this.selector.isExcluded( subData ) ) {
                     if ((!this.selector.options.unitType) || subData.typeList.indexOf(this.selector.options.unitType)!==-1){
+
+                        debugger;
                         var unit = this.selector._newItem(subData, this.selector, this.children, this.level+1, this);
                         if(this.subItems)this.subItems.push( unit );
                     }