EXT Click the button button grid to add a row (cursor position can be set) instance code _javascript tips

Source: Internet
Author: User

First of all, what is ext

Ext is a powerful JS class library, formerly based on Yahoo-ui, now completely independent, including Data,widget,form,grid,dd,menu, the most powerful should be counted in the grid, programming ideas is based on object-oriented programming (OOP), Extensibility is quite good. You can write your own extensions. You can define namespaces yourself. Web applications may feel too large. However, you may need to load the class library you want as needed.

This includes three large file Ext-all.css,ext-base.js,ext-all.js (including all class libraries, which you can cut as needed). The official website provides this interface, when referencing the Ext class library. These three files are essential.

It provides a rich, very beautiful look at the experience, become a lot of interface layer developers in pursuit! Its core components basically cover the common components we use to build rich clients.

Starting with EXT 2, the Business Edition (for those with profit-oriented developers) will be charged.
This may affect some of his application prospects. The latest version is 3.2.2

1. Create an Add button that listeners the Click event of the button in the event,

{
ID: ' button1 ',
xtype: ' button ',
margin: ' 6 ',
text: ' Add ',
Name: ' Btn-add ',
iconcls: ' Btn-add ',
listeners:{
click:function () {
var r = ext.create (' itemgridmdl ', {//...
}); /The data to insert the table
ext.getcmp (' grid1 '). GetStore (). Insert (ext.getcmp (' grid1 '). GetStore (). GetCount (), R);//Add a row at the end of the table
Cellediting.canceledit ();
Cellediting.starteditbyposition ({///The position of the cursor appearing in the table to be edited
row:Ext.getCmp (' grid1 '). GetStore (). GetCount ()-1,
Column:1
});}}

2. How to call this button

EXT.GETCMP (' Fbutton '). FireEvent (' click ');

3.grid Table Plugins: Configuration of properties:

plugins:[
cellediting=ext.create (' Ext.grid.plugin.CellEditing ', {
clickstoedit:1,
listeners: {
Edit:function (editor,e) {
}
}
})
],

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.