-
- Ext.onReady(function(){
-
- var itemsTpl = new Ext.Template(
- '<li class="{cls}" id="{id}" width="240px"><a class="x-tab-strip-close" onclick="return false;"></a>',
- '<a class="x-tab-right" href="#" onclick="return false;"><a class="header-uncheck" onclick="return false;"></a><em class="x-tab-left">',
- '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
- '</em></a></li>'
- );
-
- itemsTpl.disableFormats = true;
- itemsTpl.compile();
- var tabs = new Ext.TabPanel({
- tabWidth : 200,
- activeTab : 0,
- title : "123",
- items : [new Ext.Panel({title : "hahaha---" , html : "--++-00"}),new Ext.Panel({title : "123" , html : "xixi"})],
- width : 600,
- height : 500,
- itemTpl : itemsTpl ,
- checkElClick : function(tab , checkEl){
- if(!checkEl.hasClass("header-check")){
- checkEl.addClass("header-check");
- }else{
- checkEl.removeClass("header-check");
- }
- this.fireEvent("headercheck" , this , tab , checkEl.hasClass("header-check") , checkEl);
- }
- });
-
- tabs.on("render" , function(){
- tabs.items.each(function(tab){
- var checkEl = Ext.get(tabs.getTabEl(tab)).child(".header-uncheck");
- checkEl.on("click" , this.checkElClick.createDelegate(this,[tab,checkEl]));
- },this);
- },tabs);
-
- tabs.render(Ext.getBody());
-
-
- });
- ------------------------------css样式-----------------------------------
- .header-uncheck{
- background-image:url(../../ext/resources/images/default/form/radio.gif);
- width:12px;
- font-size:11px;
- float:left;
- }
- .header-check{
- background-position:0 13px;
- }
复制代码 |