首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

extjs的panel中tbar的按钮如何居右

2012-04-23 
extjs的panel中tbar的按钮怎么居右谢谢[解决办法]我试了好多种都不行呢, p.getTopToolbar().add(new Ext.T

extjs的panel中tbar的按钮怎么居右
谢谢

[解决办法]
我试了好多种都不行呢, p.getTopToolbar().add(new Ext.Toolbar.Spacer()); 只有这个笨方法可以,在面板的 tbar 里加入 Spacer (空格),通过一个 for 循环一点一点的调试到中间去? 呵呵,笨人笨方法 ,见笑了,望高人来。

JScript code
Ext.onReady(function(){     Ext.BLANK_IMAAGE_URL ='../ext/resources/images/default/s.gif';     Ext.QuickTips.init();     Ext.form.Field.prototype.msgTarget = 'side';     var p = new Ext.Panel({        title: 'My Panel',        collapsible:true,        renderTo: 'User_InfoMange',        width:400,        html:'<font color=blue>asdflkj<br/> aslkdfj <br/>lkajs lkfj<br/> alskdj f<br/></font>',        buttonsAlgin:'center',    //    config:{    //        buttonsAlgin:'center'    //    },        tbar:[        ]    });    for(var i=0;i<50;i++){        p.getTopToolbar().add(new Ext.Toolbar.Spacer());    }        p.getTopToolbar().add({text:"显示"});       });
[解决办法]
试试这个,关键就在于'->',这是tbar里是按钮居右的符号,就像'-'是分隔符一样。
JScript code
tbar:[{            xtype:"label",            text:"管理员:"        },{            xtype:"label",            text:Cookies.get("LogName")        },'->',{            xtype:"tbbutton",            id:"button_password",            text:"password",            handler:function(){                if(!win_password)                {                    win_password = CreateWindow({                        el:"win_password",                        title:"修改密码",                        items:CreateFormPanel(form_passwordConfig)                                                              });                }                win_password.show("button_password");            }        },'-',{            xtype:"tbbutton",            id:"button_reg",            text:"register",            handler:function(){                if(!win_reg)                {                    win_reg = CreateWindow({                        el:"win_reg",                        title:"修改密码",                        items:CreateFormPanel(form_regConfig)                                                              });                }                win_reg.show("button_reg");            }        },'-',{            xtype:"tbbutton",            text:"logout",            handler:function(){                Ext.MessageBox.confirm("警告","您确定要注销吗?",function(button){                    if(button == "yes")                    {                        window.location = "../Default.aspx";                    }                });            }        }] 

热点排行