search
HomeDatabaseMysql TutorialExtjs+Grails教程系列2(Extjs组件大致介绍)

教程1补充: 如果跟着教程1做完后,你肯定会既激动又纳闷,网页里面的脚本到底是什么意思?比如Ext.onReady(function(){...}) ; 这个Ext.onReady()意思就是只有在Ext框架全部加载完后才能在客户端的代码中使用Ext,而Ext的onReady正是在Ext框架及页面的html

教程1补充:

如果跟着教程1做完后,你肯定会既激动又纳闷,网页里面的脚本到底是什么意思?比如Ext.onReady(function(){...}) ;

这个Ext.onReady()意思就是只有在Ext框架全部加载完后才能在客户端的代码中使用Ext,而Ext的onReady正是在Ext框架及页面的html代码加载完后用来注册所要执行的函数。

具体参考信息的话,大家可以参考这里:

1:http://book.51cto.com/art/201003/191905.htm

2:http://dujuntian.blog.163.com/blog/static/2837755420103160461840/

写到这里,我说几句废话:本人写这些博客,一来是让新手快速上手,因为这些文章是我学了历程的体现,大家可以参考,二来给自己做个总结,至于理解,可以在后面学习深入情况下,慢慢加深。我在公司做Ext,刚开始也是短时间就让做出界面,至于理解,也是模模糊糊的,我也是参考例子给一点一点摸索出来,后来等自己学得差不多的时候再回头去看,觉得Extjs真的并没有想象的那么恐怖,知识如果之前从来没接触过的话,刚开始学习坡度确实陡了点。还好,只要大家坚持,2个礼拜,基本都能很熟悉Extjs。

2.1Extjs组件简介

    Ext JS还设计了良好的组件体系,组件大致可以分成三大类,即基本组件、工具栏组件、表单及元素组件。

    本人建议:新手刚开始的话,可以接触FormPanel作为入手学习,等自己的FormPanel学得不错了,就可以迁移到更多的组件学习,毕竟,在现在的Web开发中,表单用的是最多的。

    创建一个组件,通用的方法是跟java差不多,通过关键字new出来一个对象。比如一个按钮,可以这么写

Ext.onReady(function(){
	var oTestButton = new Ext.Button({
		//以下是配置信息
		renderTo:Ext.getBody() ,//渲染到网页上面
		text:'这是按钮上的文字',//按钮文字
		handler:function(){
			alert('点击按钮就会调用我') ;
		}//这个是点击按钮激发的事件,handler只对按钮起作用
	}) ;
}) ;

  上面一个简单的几行代码,就创建出来一个按钮对象,如果想创建其他不同的对象,都可以参照以上方式。在Extjs中,用xtype区分不同的组件,xtype就像各个组件类型的代号一样,比如定义xtype为button,那么组件将以button显示出来,如果定义xtype为form,那么组件将以表单组件显示。到后面的应用中,大家都会明白xtype的含义。

    在Extjs中,所有的组件的xtype定义如下:
    xtype属性的基本组件列表

xtype

   

box

Ext.BoxComponent,具有边框属性的组件

button

Ext.Button,按钮

colorpalette

Ext.ColorPalette,调色板

component

Ext.Component,组件

container

Ext.Container,容器

cycle

Ext.CycleButton,可自动循环的分割按钮

dataview

Ext.DataView,数据显示视图

datepicker

Ext.DatePicker,日期选择面板

editor

Ext.Editor,编辑器

editorgrid

Ext.grid.EditorGridPanel,可编辑的表格

grid

Ext.grid.GridPanel,表格

paging

Ext.PagingToolbar,工具栏中的间隔

panel

Ext.Panel,面板

progress

Ext.ProgressBar,进度条

splitbutton

Ext.SplitButton,可分裂的按钮

tabpanel

Ext.TabPanel,选项面板

treepanel

Ext.tree.TreePanel,树

viewport

Ext.ViewPort,视图

window

Ext.Window,窗口

xtype属性的表单组件列表

xtype

   

form

Ext.FormPanelForm面板

checkbox

Ext.form.Checkboxcheckbox录入框

combo

Ext.form.ComboBoxcombo选择项

datefield

Ext.form.DateField,日期选择项

field

Ext.form.Field,表单字段

fieldset

Ext.form.FieldSet,表单字段组

hidden

Ext.form.Hidden,表单隐藏域

htmleditor

Ext.form.HtmlEditorhtml编辑器

numberfield

Ext.form.NumberField,数字编辑器

radio

Ext.form.Radio,单选按钮

textarea

Ext.form.TextArea,区域文本框

textfield

Ext.form.TextField,表单文本框

timefield

Ext.form.TimeField,时间录入项

trigger

Ext.form.TriggerField,触发录入项

xtype属性的工具栏组件列表

xtype

   

toolbar

Ext.Toolbar,工具栏

tbbutton

Ext.Toolbar.Button,按钮

tbfill

Ext.Toolbar.Fill,文件

tbitem

Ext.Toolbar.Item,工具条项目

tbseparator

Ext.Toolbar.Separator,工具栏分隔符

tbspacer

Ext.Toolbar.Spacer,工具栏空白

tbsplit

Ext.Toolbar.SplitButton,工具栏分隔按钮

tbtext

Ext.Toolbar.TextItem,工具栏文本项

 

2.2Extjs组件的应用

其实,在Extjs提供的API里面,还有Extjs提供的Example里面,已经有很多的例子了,大家参考下例子,对应着API各个组件的属性,方法,应该都是可以慢慢摸索出来的,我学习的历程,几乎就是摸索Example代码的过程,把Example看差不多了,Extjs你也就掌握差不多了。

 

 

 

 

Statement
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
MySQL's Place: Databases and ProgrammingMySQL's Place: Databases and ProgrammingApr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL: From Small Businesses to Large EnterprisesMySQL: From Small Businesses to Large EnterprisesApr 13, 2025 am 12:17 AM

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?Apr 13, 2025 am 12:16 AM

InnoDB effectively prevents phantom reading through Next-KeyLocking mechanism. 1) Next-KeyLocking combines row lock and gap lock to lock records and their gaps to prevent new records from being inserted. 2) In practical applications, by optimizing query and adjusting isolation levels, lock competition can be reduced and concurrency performance can be improved.

MySQL: Not a Programming Language, But...MySQL: Not a Programming Language, But...Apr 13, 2025 am 12:03 AM

MySQL is not a programming language, but its query language SQL has the characteristics of a programming language: 1. SQL supports conditional judgment, loops and variable operations; 2. Through stored procedures, triggers and functions, users can perform complex logical operations in the database.

MySQL: An Introduction to the World's Most Popular DatabaseMySQL: An Introduction to the World's Most Popular DatabaseApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

The Importance of MySQL: Data Storage and ManagementThe Importance of MySQL: Data Storage and ManagementApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system suitable for data storage, management, query and security. 1. It supports a variety of operating systems and is widely used in Web applications and other fields. 2. Through the client-server architecture and different storage engines, MySQL processes data efficiently. 3. Basic usage includes creating databases and tables, inserting, querying and updating data. 4. Advanced usage involves complex queries and stored procedures. 5. Common errors can be debugged through the EXPLAIN statement. 6. Performance optimization includes the rational use of indexes and optimized query statements.

Why Use MySQL? Benefits and AdvantagesWhy Use MySQL? Benefits and AdvantagesApr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Apr 12, 2025 am 12:16 AM

InnoDB's lock mechanisms include shared locks, exclusive locks, intention locks, record locks, gap locks and next key locks. 1. Shared lock allows transactions to read data without preventing other transactions from reading. 2. Exclusive lock prevents other transactions from reading and modifying data. 3. Intention lock optimizes lock efficiency. 4. Record lock lock index record. 5. Gap lock locks index recording gap. 6. The next key lock is a combination of record lock and gap lock to ensure data consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use