提交 35470a88 编写于 作者: U unknown

选择框增加expand\collapse事件

上级 d5683e0a
......@@ -27,7 +27,7 @@ MWF.xApplication.Selector.Person = new Class({
"hasShuttle" : false, //穿梭按钮
"searchbarInTopNode" : true, //搜索框在标题上还是另起一行
"hasSelectedSearchbar" : false, //已选是不是有搜索框
"noSelectedContainer" : true, //是否有已选项
"noSelectedContainer" : false, //是否隐藏右侧已选区域
"contentUrl" : "", //和默认的页面布局不一样的话,可以传入页面布局HTML URL
"injectToBody" : false, //当传入HTML URL的时候是否插入到document.body, false的时候插入到this.container
......@@ -2395,6 +2395,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
if (!this.fx.isRunning()){
var display = this.children.getStyle("display");
if (display === "none"){
this.selector.fireEvent("expand", [this] );
this.children.setStyles({
"display": "block",
"height": "0px"
......@@ -2403,6 +2404,7 @@ MWF.xApplication.Selector.Person.ItemCategory = new Class({
this.actionNode.setStyles(this.selector.css.selectorItemCategoryActionNode_expand);
this.isExpand = true;
}else{
this.selector.fireEvent("collapse", [this] );
if (!this.childrenHeight) this.childrenHeight = this.children.getStyle("height").toFloat();
this.fx.start("height", ""+this.childrenHeight+"px", "0px").chain(function(){
this.children.setStyles({
......
......@@ -232,9 +232,9 @@ MWF.xApplication.Selector.Unit.Item = new Class({
debugger;
if( !this.selector.options.expandSubEnable )return;
this.isExpand = (this.selector.options.expand);
if ( this._hasChild() ){
if ( this._hasChild() || this.selector.options.expandEmptyCategory ){
if (this.selector.options.expand){
if (this.level===1){
if (this.level===1 && this._hasChild() ){
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
this.loadSubItems();
}else{
......@@ -246,10 +246,12 @@ MWF.xApplication.Selector.Unit.Item = new Class({
}
this.levelNode.addEvent("click", function(e){
if (this.isExpand){
this.selector.fireEvent("collapse", [this] );
this.children.setStyle("display", "none");
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_collapse);
this.isExpand = false;
}else{
this.selector.fireEvent("expand", [this] );
this.loadSubItems();
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
this.isExpand = true;
......
......@@ -141,10 +141,12 @@ MWF.xApplication.Selector.UnitWithType.Item = new Class({
}
this.levelNode.addEvent("click", function(e){
if (this.isExpand){
this.selector.fireEvent("collapse", [this] );
this.children.setStyle("display", "none");
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_collapse);
this.isExpand = false;
}else{
this.selector.fireEvent("expand", [this] );
this.loadSubItems();
this.levelNode.setStyles(this.selector.css.selectorItemLevelNode_expand);
this.isExpand = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册