Home > Web Front-end > JS Tutorial > About the relationship between viewport, Ext.panel and Ext.form.panel_extjs

About the relationship between viewport, Ext.panel and Ext.form.panel_extjs

WBOY
Release: 2016-05-16 18:53:18
Original
1136 people have browsed it

Ext.panel can store many elements, the most common one is Ext.form.formPanel object, you can also use borderlayout layout
The following is a small example I wrote, the top container is not viewport but tabpanel

Copy code The code is as follows:

//An ordinary form
var frm = new Ext.form.FormPanel( {
defaultType: 'textfield',
labelAlign: 'right',
title: 'form1-center',
labelWidth: 50,
frame: true,
width: 120 ,
height:200,
region: 'center',
closable: true, //This attribute can control the closing of the from
items: [{
fieldLabel: 'text box'
}],
buttons: [{
text: 'Button'
}]
});
//Comrades, please note that region means borderlayout layout, in center Position
// Below I create a grid
// grid start
var cm = new Ext.grid.ColumnModel([
{ header: 'number', dataIndex: 'id' },
{ header: 'name', dataIndex: 'name' },
{ header: 'description', dataIndex: 'descn' }
]);
var data = [
[' 1', 'name1', 'descn1'],
['2', 'name2', 'descn2'],
['3', 'name3', 'descn3'],
[ '4', 'name4', 'descn4'],
['5', 'name5', 'descn5']
];
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({}, [
{ name: 'id' },
{ name: 'name' } ,
{ name: 'descn' }
])
});
ds.load();
var grid = new Ext.grid.GridPanel({
ds: ds,
cm: cm,
title: 'center-north',
region: 'north',
width:200,
height:200
});
// grid end
//Comrades, please note that region means borderlayout layout, at the north position
//Ext.panel can contain other panels
var fullForm = new Ext.Panel({
title: 'I am very good',
closable: true,
border: true,
layout: 'border',//Please pay attention to his layout
items: [grid, frm]
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template