導航:首頁 > 編程語言 > extjspanel圖片

extjspanel圖片

發布時間:2025-09-02 07:43:31

⑴ extjs如何設置panel默認為收縮狀態

設置collapsed為true就是收縮狀態專屬

Ext.create("Ext.Panel",{
//設置collapsed為true,就是收縮狀態
collapsed:true,
collapsible:true
});

⑵ extjs的panel組件怎麼使用

//html代碼
<div id="container">
</div>

//js代碼
var p = new Ext.Panel({
title: 'My Panel',//標題
collapsible:true,//右上角上的那個收縮按鈕,設為false則不顯示
renderTo: 'container',//這個panel顯示在html中id為container的層中
width:400,
height:200,
html: "<p>我是內容,我包含的html可以被執行!</p>"//panel主體中的內容,可以執行html代碼
});

因為panel組件的子類組件包括TabPanel,GridPanel,FormPanel,TreePanel組件,所以非常有必要介紹Panel組件的配置參數和相關的屬性、方法。

//配置參數(只列舉部分常用參數)
1.autoLoad:有效的url字元串,把那個url中的body中的數據載入顯示,但是可能沒有樣式和js控制,只是html數據
2.autoScroll:設為true則內容溢出的時候產生滾動條,默認為false
3.autoShow:設為true顯示設為"x-hidden"的元素,很有必要,默認為false

4.bbar:底部條,顯示在主體內,//代碼:bbar:[{text:'底部工具欄bottomToolbar'}],
5.tbar:頂部條,顯示在主體內,//代碼:tbar:[{text:'頂部工具欄topToolbar'}],
6.buttons:按鈕集合,自動添加到footer中(footer參數,顯示在主體外)//代碼:buttons:[{text:"按鈕位於footer"}]
7.buttonAlign:footer中按鈕的位置,枚舉值為:"left","right","center",默認為right

8.collapsible:設為true,顯示右上角的收縮按鈕,默認為false
9.draggable:true則可拖動,但需要你提供操作過程,默認為false

10.html:主體的內容
11.id:id值,通過id可以找到這個組件,建議一般加上這個id值
12.width:寬度
13.height:高度
13.title:標題

14.titleCollapse:設為true,則點擊標題欄的任何地方都能收縮,默認為false.

15.applyTo:(id)呈現在哪個html元素裡面
16.contentEl:(id)呈現哪個html元素裡面,把el內的內容呈現
17.renderTo:(id)呈現在哪個html元素裡面
//關於這三個參數的區別(個人認為:applyTo和RenderTo強調to到html元素中,contentEl則是html元素到ext組件中去):
英文如下(本人英語poor,不敢亂翻譯):
contentEl - This config option is used to take existing content and place it in the body of a new panel. It is not going to be the actual panel itself. (It will actually the innerHTML of the el and use it for the body). You should add either the x-hidden or the x-hide-display CSS class to prevent a brief flicker of the content before it is rendered to the panel.
applyTo - This config option allows you to use pre-defined markup to create an entire Panel. By entire, I mean you can include the header, tbar, body, footer, etc. These elements must be in the correct order/hierarchy. Any components which are not found and need to be created will be autogenerated.
renderTo - This config option allows you to render a Panel as its created. This would be the same as saying myPanel.render(ELEMENT_TO_RENDER_TO);
哪位大人幫忙翻譯下...
考慮到入門,方法事件會在以後的文章中以實例穿插。
1.可拖動的panel實例
下面我們做個可拖動panel例子來熟悉下panel這個最基本的組件.

//html代碼
..無..

//下面創建一個允許拖動的panel,但是拖動的結果不能保存
var p=new Ext.Panel({
title: 'Drag me',
x: 100,
y: 100,
renderTo: Ext.getBody(),//x,y,renderTo:Ext.getBody()初始化panel的位置
floating: true,//true
frame: true,//圓角邊框
width: 400,
height: 200,
draggable:true
}).show();//在這里也可以不show()
但是還不能拖到其他的地方,我們需要改寫draggable:

draggable: {
insertProxy: false,//拖動時不虛線顯示原始位置

onDrag : function(e){
var pel = this.proxy.getEl();
this.x = pel.getLeft(true);
this.y = pel.getTop(true);//獲取拖動時panel的坐標
},
endDrag :

function(e){
this.panel.setPosition(this.x, this.y);//移動到最終位置
}
}
實現了可保存的拖動

拖動的時候陰影還在原位置,我們再在draggable中的onDrag事件中添加代碼:

var s = this.panel.getEl().shadow;
if (s) {
s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
}
//shadow的realign方法的四個參數,改變shadow的位置大小屬性
最後這個可拖動的panel的代碼為:

var p=new Ext.Panel({
title: 'Drag me',
x: 100,
y: 100,
renderTo: Ext.getBody(),
floating: true,
frame: true,
width: 400,
height: 200,
draggable: {
insertProxy: false,
onDrag :

function(e){
var pel = this.proxy.getEl();
this.x = pel.getLeft(true);
this.y = pel.getTop(true);

var s = this.panel.getEl().shadow;
if (s) {
s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
}
},
endDrag : function(e){
this.panel.setPosition(this.x, this.y);
}
}
})
//效果圖片我就不貼出來了
2.帶頂部,底部,腳部工具欄的panel

var p=new Ext.Panel({
id:"panel1",
title:"標題",
collapsible:true,
renderTo:"container",
closable:true,
width:400,
height:300,
tbar:[{text:"按鈕1"},{text:"按鈕2"}], //頂部工具欄
bbar:[{text:"按鈕1"},{text:"按鈕2"}], //底部工具欄
html:"內容",
buttons:[{text:"按鈕1"},{text:"按鈕2"}] //footer部工具欄
});

我們已經在各種工具欄上添加了按鈕,但是卻沒有激發事件,下面我們來添加按鈕事件代碼:

tbar:[{text:"按鈕1",handler:function(){Ext.MessageBox.alert("我是按鈕1","我是通過按鈕1激發出來的彈出框!")}},{text:"按鈕2"}],
//改寫tbar,添加handler句柄,點擊頂部工具欄上按鈕1,彈出提示框,效果圖大家想像下,就不貼出來了
當然,一般情況下,我們只要一個工具欄,這里只是為了演示!
3.panel工具欄

//添加下面的代碼到panel配置參數中
tools:[{id:"save"},{id:"help"},{id:"up"},{id:"close",handler:function(){Ext.MessageBox.alert("工具欄按鈕","工具欄上的關閉按鈕時間被激發了")}}],
//id控制按鈕,handler控制相應的事件
//id的枚舉值為:
toggle (collapsable為true時的默認值)
close
minimize
maximize
restore
gear
pin
unpin
right
left
up
down
refresh
minus
plus
help
search
save
print

⑶ extjs中怎樣為一個panel設置背景色

是這樣設置 bodyStyle: 'background:#ffc; padding:10px;',
var resultsPanel = Ext.create('Ext.panel.Panel', {
title: 'Results',
width: 600,
height: 400,
renderTo: Ext.getBody(),
bodyStyle: 'background:#ffc; padding:10px;',
layout: {
type: 'vbox', // Arrange child items vertically
align: 'stretch', // Each takes up full width
padding: 5
},
items: [{ // Results grid specified as a config object with an xtype of 'grid'
xtype: 'grid',
columns: [{header: 'Column One'}], // One header just for show. There's no data,
store: Ext.create('Ext.data.ArrayStore', {}), // A mmy empty data store
flex: 1 // Use 1/3 of Container's height (hint to Box layout)
}, {
xtype: 'splitter' // A splitter between the two child items
}, { // Details Panel specified as a config object (no xtype defaults to 'panel').
title: 'Details',
bodyPadding: 10,
items: [{
fieldLabel: 'Data item',
xtype: 'textfield'
}], // An array of form fields
flex: 2 // Use 2/3 of Container's height (hint to Box layout)
}]
});

⑷ 如何用Extjs進行下面的布局,整體是個panel 內部3個子panel 並且還可以拆分成2部分(如圖)

簡單來說,就是hbox或column橫向布局,再用vbox縱向布局

代碼如下:

Ext.onReady(function(){

Ext.create('Ext.panel.Panel',{

layout:{
type:'column'
},
default:{
xtype:'panel'
},
border:1,
width:600,
height:400,
padding:10,
items:[{
margin:'30px',
width:150,
height:290,
layout:'vbox',
items:[{
width:150,
height:90,
html:'form'
},{
width:150,
height:200,
html:'grid<br>Panel'
}]
},{
margin:'30px30px30px0',
width:150,
height:290,
layout:'vbox',
items:[{
width:150,
height:90,
html:'form'
},{
width:150,
height:200,
html:'grid<br>Panel'
}]
},{
margin:'30px30px30px0',
width:150,
height:290,
layout:'vbox',
items:[{
width:150,
height:90,
html:'form'
},{
width:150,
height:200,
html:'grid<br>Panel'
}]
}],
renderTo:Ext.getBody()
})

效果如下圖:

⑸ 請問EXTJS的panel怎麼關閉

用destroy()可以關閉,如:
var panel1=new Ext.panel({
......,

tools:[{
id:"close",
handler:function(){
panel1.destroy();
}

})

⑹ extjs中怎樣為一個可收縮collapsible的panel設置標題欄(標題欄文字有各種顏色的和各種字體的)

是這樣設置bodyStyle:'background:#ffc;padding:10px;',varresultsPanel=Ext.create('Ext.panel.Panel',{title:'Results',width:600,height:400,renderTo:Ext.getBody(),bodyStyle:'background:#ffc;padding:10px;',layout:{type:'vbox',//:'stretch',//Eachtakesupfullwidthpadding:5},items:[{//'grid'xtype:'grid',columns:[{header:'ColumnOne'}],//Oneheaderjustforshow.There'snodata,store:Ext.create('Ext.data.ArrayStore',{}),//Ammyemptydatastoreflex:1//Use1/3ofContainer'sheight(hinttoBoxlayout)},{xtype:'splitter'//},{//(noxtypedefaultsto'panel').title:'Details',bodyPadding:10,items:[{fieldLabel:'Dataitem',xtype:'textfield'}],//Anarrayofformfieldsflex:2//Use2/3ofContainer'sheight(hinttoBoxlayout)}]});

閱讀全文

與extjspanel圖片相關的資料

熱點內容
postgresqljavajdbc 瀏覽:413
寧波市ug編程培訓中心在哪裡學 瀏覽:54
u盤的系統鏡像文件 瀏覽:665
java中界面設計 瀏覽:887
積分換雞蛋什麼APP 瀏覽:169
雲服務app有什麼用 瀏覽:74
文件不見了怎麼找回來 瀏覽:68
電路數據線是什麼意思 瀏覽:34
文件壓縮包怎麼打開 瀏覽:184
圖片文件變成excel 瀏覽:330
資料庫還原錯誤 瀏覽:937
蘋果6splus行貨和水貨怎麼區分 瀏覽:724
用手機qq郵箱怎麼發word文件 瀏覽:685
桌面的壓縮文件路徑太長 瀏覽:22
vfp表單按鈕代碼 瀏覽:6
1年java轉大數據要多少時間 瀏覽:618
extjspanel圖片 瀏覽:967
新手第一次學編程要注意什麼 瀏覽:519
手機上TXT文件 瀏覽:282
20款皓影19寸輪轂什麼數據 瀏覽:688

友情鏈接