Home Web Front-end JS Tutorial Commonly used add, delete, modify and check operation codes in extJs_extjs

Commonly used add, delete, modify and check operation codes in extJs_extjs

May 16, 2016 pm 06:37 PM
extjs Add, delete, modify and check

Copy code The code is as follows:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


< head>
                                                                                                                                                                                                                              ;%@ include file="../extJs/CommonJs.jsp"%>
                                                                                             

//Set the default number of rows displayed on each page to 10

var QUERY_PAGE_SIZE = 10;

/**
* Author: Hua Hui
* Time: December 22, 2009
* Content: Add, delete, modify and check operations commonly used in extJs
*/
function searchQueryForm()
{> // Form is recommended to be set to a local variable when used. You can get Form

var QueryForm = NULL;
QueryForm = New Ext. Formpanel ({
ID: 'queryform', // Specify the ID
renderto: 'searchpanel' of Queryform, // // point to the DIV layer where Form is
Labelwidth: 70, // Label label the width occupation page. The percentage of
region:'north',
border:false, //To display the border of the panel's body element, falsely hide it (default is true)
badyBorder:false, //Display the panel's body Elements, hypothesis to hide it (the internal boundary of the default TRUE)
Labelign: 'Right', // Label label alignment method
Frame: true, // The round boundary of the custom panel, the border width 1px 1px 1px .Default is false
                                                                                                                                                                                              🎜>                                                                                                                                                                                                                                                                            through 🎜> items:[{
                                                                                 columnWidth:.5,
layout:'form',
items :{
                                                                                       xtype:'textfield',
fieldLabel:'user code',
maxLength:'50',
vtype:'specialChar',
anchor:'80%'
}
                                       ,{
                         columnWidth:.5,
                         layout:'form',
                         items:{
                             name:'userName',
                             hiddenName:'userName',
                             xtype:'textfield',
                             fieldLabel:'用户名称',
                             maxLength:'100',
                             vtype:'specialChar',
                             anchor:'80%'
                         }
                     }
                 ]
             }]
            });
        }
/**
* showUserForm(): Draw and add a form
*/
function showUserForm()
{
//Define variables as local variables to avoid generating a new object every time

var userForm = null; 'right',
border:false,
                                                                                                                                                                                                               ms:[
                                                                                                                                                     items:{
name:'userInfo.userId',
hiddenName:'userInfo.userId', //hiddenName dynamically binds the corresponding field in the database
              xtype:'textField', //xtype can Divided into three categories, textField is the control of the form field 🎜>                                                                                                                                                                                                                                                     BlankText: 'Fill in the user code', // Prompt message for empty text box maxLength:'50', //The maximum input allowed in the text box Length, minimum minLength
vtype:'specialChar',
anchor:'80%'
                                   ,{
columnWidth:'.8',
items:{
name:'userInfo.userName',                                                                                                                                                                                                                                    hiddenName:'userInfo.userName',
                    A> FieldLabel: 'User name & lt; font color = red & gt;*& lt;/font & gt;',
labelseparator: '',
Blanktext: 'Fill in the user name',
a llowblank: false,
                  maxLength:'100',                                                                                                                                                                                                                                                                                                                                                                                                                                             ; { name: 'userInfo.pwd',
Hiddenname: 'userInfo.pwd',
XType: 'TextField',
Inputtype: 'Password',
Fie ldlabel: 'User Password & LT ;font color=red>*',
labelSeparator:'',
blankText:'Fill in user password',
allowBlank:false,
maxLength:'12',
minLength:'6',
value:'123456', //User default secret
anchor:'1 00%'
                                                                                            ,{
columnWidth:'.8',
items:{
name:'rPwd',
HiddenName:'rPwd',
xtype:'textField',
inputType: 'password',
fieldLabel:'Confirm password*',
labelSeparator:'',
BlankText: 'Secrets entered twice must be the same',
allowBlank:false,
vtype:'pwdRange',
pwdRange:{begin:' userInfo.pwd',end:'rPwd'},
       maxLength:'12',
      anchor :'100%'
                                                                    
                                                                                                           
userForm = new Ext.FormPanel({
id:'editForm',
labelWidth:'80',
labelAlign:'right ',
                      border: false, false,
frame:true,
items:[
layout:'column',
items:[
{
columnWidth:'.8',
items:{
name:'userInfo.userId',
hiddenName:'userInfo.userId', //hiddenName dynamically binds the corresponding field in the database
          xtype:'textField', //xtype can be divided into three Class, textField is the control of the form field        readOnly:true, //The text box is read-only
disabled:true, // The text box is gray, different from other text box colors
MaxLength: '50 ', // The text box allows the maximum length of the input, the smallest minLength
// let the letter start, and only the letters and the number length of 2 to 12 can be existed

regex: /^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){1,11}$/,
      regexText: 'User code must start with a letter, Length 2-12 digits!',
anchor:'90%'
}
,{
columnWidth:'.8',
items:{
name:'userInfo.userName',                                                                                                                                                                                                                                    hiddenName:'userInfo.userName',
                    A> FieldLabel: 'User Name',
LabelsePaator: ':',
Blanktext: 'Fill in the user name',
AllowBlank: False,
MaxLength: '100',
///> /// Contains only Chinese characters, numbers, letters, and underscores. It cannot start or end with an underscore

regex: /^(?!_)(?!.*?_$)[a-zA-Z0-9_u4e00-u9fa5] $/,
regexText: 'Contains only Chinese characters, numbers, letters, and underscores and cannot start and end with underscores!',
anchor:'90%'
} }
              },{                                                                                                                                                                                    :'.2',
items:{
hiddenName:"infoFill",
name:"infoFill",
xtype:'label',
html:'*',
labelSeparator:'',
anchor:'100%'
} }
,{
columnWidth:'.8',
items:{
name:'userInfo.pwd',                                                                                                                                                                                                                            hiddenName:'userInfo.pwd',
                                       ​​​labelSeparator:':',
blankText:'Fill in user password' ,
allowBlank:false,
maxLength:'12',
minLength:'6',
anchor:'90%'
}
},{
columnWidth: '.2',
items:{
hiddenName:"infoFill",
name:"infoFill",
xtype:'label',
html:'',
labelSeparator:'',
anchor:'100%'
}
,{
columnWidth:'.8',
items:{
name:'rPwd',
HiddenName:'rPwd',
xtype:'textField',
inputType: 'password',
fieldLabel:'Confirm password*',
labelSeparator:':',
BlankText: 'Secrets entered twice must be the same' ,
                                                                                                                                                                                                                                           allowBlank:false,                // vtype is the verification method, if it is a general verification, please If it is a special case, you can use regex
vtype:'pwdRange',
                                     maxLength:'12',
anchor:'90%'
}
columnWidth:'. 2',
items:{
hiddenName:"infoFill",
name:" infoFill",
xtype:'label',
html:'*',
labelSeparator:'',
anchor:'100%'
                                                                                                                       
/**
* onReady: The file is ready (before onload and image loading)
**/
Ext.onReady(function(){

searchQueryForm();
//Get query form

var queryForm = Ext .getCmp("queryForm").getForm(); Defaluts:{ border:false,bodyBorder:false,activeTab:0},
items:[queryForm,{id:'centerPanel',region:'center',height:document.body.clientHeight,contentEl:'mainDiv'}]
           }); /query information
var store = new Ext.data.Store({
url:'../user/doGetPageList.action', //action path
reader:new Ext.data.JsonReader({
root:'userList', //Parameters passed from struts2.0: User collection
      totalProperty:'rowTotal', //Parameters passed from struts2.0: Total number of rows of information
                                                                                                   through 🎜>      });

                                         **
* Layout set to border means the page will be divided into five parts, southeast, northwest, and middle
* This means the centerPanel is placed in the middle
*/
function getMsg()
{

}
/**
* callback: function called
**/
function submitForm() {
//Initialize grid
var grid = null;
//Checkbox
var sm = new Ext.grid.CheckboxSelectionModel({
dataIndex:'id',
width:'20 '
              );                                     The functionality of the cell's HTML tag. If not specified, the default renderer uses the raw data value.
                                                                                                                                                                             > var colM = new Ext.grid.ColumnModel(
Name',dataIndex:'userName',align:'center',sortabel:true},
      {header:'delete',dataIndex:'id',align:'center',renderer:function createButton(){
                 return 'delete';}},
                                                                                                                                                                                                                                              {header:'edit',dataIndex:'userId',align:'center',renderer:function createButton(userId, metadata, record){ a style="cursor:hand" style="cursor:hand" onclick=updateForm(' userId ') >' record.get('userName') 'Information modification' '';}}]
);
// Get the query form

var Form = EXT.GETCMP ("QueryForm"). Getform ();

// determine whether to pass the verification , if not, please close it directly
                                                                                                                                                                           🎜>                                                                                        /**
* getLimitCount() : Get the number of rows per page for paging. If no value is passed, the default value will be used. When, execute function getMsg.Can be omitted
*/

store.load({params:{start:0,limit:getLimitCount()}, callback:getMsg});
if(grid == null)
                                                                                                                                                                                                                                                                    title:"User query results", //grid title
              width:document.body.clientWidth, //Set the value of grid’s width
                                                                                                                                                                                     viewConfig:{forceFit:true}, // Set the full window of the number of columns Region:'center', //This is set in The position displayed in the ViewPort is
cm:colM, //The defined column
ds:store, //The defined data source
border:false,
bodyBorder:false,
, // The defined check box

// Listeners: Including one or more event handling procedures is added to this object's initialization process

Listeners: {cellclick: renderPage}},
                                                                                                     ​ 🎜>                                        xtype:'button', Select ', 🎜>                                                                                                                                                                                                                                                      through The default is: query_page_size
Store: Store,
Displayinfo: True,
Displaymsg: 'Display the record of {0} to the record of {1}. ;                                                                                                                                                                                                                                                                         .
                                                                                                                              var userForm = Ext .getCmp("conditionForm").getForm();
                                                                                                 null)
                                                                                                                                                                                                                              x:100, //Initialization x-direction position of the window
                         y:100, //                                                                                                                                                                                                                                                           .          closeAction:"hide", //The default window is hidden
                 resizable: false, // The size of the window does not allow dragging, the default is true
                                                                                                                                                                               . 🎜> buttons ; {
                                                                                :'../user/addUser.action',
               params:{roleId:userForm.form.findField('userId').getValue()}, waitMsg:'Save data, Please wait...', //Scroll bar prompt content
                                                                                                                                    if(message == null){
                      Ext.Msg.alert("Prompt message", "User information added successfully!"); AddUserWin.hide();
Ext.Msg.alert("Message",message);
                                            > Ext.Msg.alert('prompt message'," Failed to add new user!");
                   return;                                                    sg.alert("Prompt message", "There is an error in the form, please fill it in correctly!");
                                                                                                       {handler:function(){addUserWin. hide();},text:'Close'}]
           });                                               
function delForm(userId)
                  ( )
                                                                                                    url:'../user/delUser.action',
    params:{userId: userId},
method:'post',
success:function(o)
{
                    var info = Ext.decode(o.responseText); Prompt information", info.message);
                                                                                                                                                                                      . User information deletion failed!");
                                                                                                                       ; >                   });
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

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 ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Java List Interface Example Demonstration: Data Operation to Implement Add, Delete, Modify and Check Operations Java List Interface Example Demonstration: Data Operation to Implement Add, Delete, Modify and Check Operations Dec 20, 2023 am 08:10 AM

The JavaList interface is one of the commonly used data structures in Java, which can easily implement data addition, deletion, modification and query operations. This article will use an example to demonstrate how to use the JavaList interface to implement data addition, deletion, modification and query operations. First, we need to introduce the implementation class of the List interface in the code, the common ones are ArrayList and LinkedList. Both classes implement the List interface and have similar functions but different underlying implementations. ArrayList is based on array real

CRUD operation of MySql: how to quickly complete addition, deletion, modification and query CRUD operation of MySql: how to quickly complete addition, deletion, modification and query Jun 15, 2023 pm 11:30 PM

MySql is a relational database management system that is very commonly used in web applications. In the entire web application development process, CRUD (Create, Delete, Modify and Check) operations are essential. This article will introduce how to quickly complete these operations in MySql. Add (Create) In MySql, we use the INSERTINTO statement to insert new rows. For example, we have a table called "users" with three columns: "id", "name" and "email". Now

How to use collection framework functions to add, delete, modify and query collections in Java How to use collection framework functions to add, delete, modify and query collections in Java Oct 25, 2023 am 08:45 AM

How to use collection framework functions in Java to perform addition, deletion, modification, and query operations on collections. In Java, the collection framework (CollectionFramework) provides a series of classes and interfaces to facilitate our collection operations. These classes and interfaces contain a wealth of functions that allow us to add, delete, modify, and search collections more conveniently. Below we'll detail how to use collections framework functions to perform these operations, and provide specific code examples. The addition operation of a collection can be done in Java

How to use PHP and ExtJS to implement powerful web application functions How to use PHP and ExtJS to implement powerful web application functions Jun 25, 2023 am 11:40 AM

With the continuous development and popularity of Web applications, more and more companies and individuals are beginning to use PHP and ExtJS to build powerful Web applications. As a popular server-side scripting language, PHP is cross-platform and easy to learn, while ExtJS is a popular front-end framework that can help developers quickly build interactive web application interfaces. This article will introduce how to use PHP and ExtJS to implement powerful web application functions. Establish PHP and MySQL database connections for use

How to handle the addition, deletion, modification and query operations of form data in Vue technology development How to handle the addition, deletion, modification and query operations of form data in Vue technology development Oct 10, 2023 pm 02:49 PM

How to handle the addition, deletion, modification and query operations of form data in Vue technology development. In the development of Vue technology, the addition, deletion, modification and query operations of form data are very common requirements. This article will introduce how to use Vue technology to handle these operations and provide specific code examples. First, we need to create a Vue instance and define an empty array in the data attribute to store the form data. For example: newVue({data(){return{formData:[

Sharing of techniques for adding, deleting, modifying and checking JSON arrays in Java. Sharing of techniques for adding, deleting, modifying and checking JSON arrays in Java. Sep 06, 2023 am 11:28 AM

Sharing skills for adding, deleting, modifying and querying JSON arrays in Java Introduction: JSON (JavaScriptObjectNotation) is a lightweight data exchange format that is widely used in various Internet applications. In Java, we can operate on JSON by using some third-party libraries, such as GSON, Jackson, etc. This article will share some techniques for adding, deleting, modifying and checking JSON arrays in Java, and provide corresponding code examples. one,

Add, delete, modify and query operations of XML data in Python Add, delete, modify and query operations of XML data in Python Aug 08, 2023 pm 09:17 PM

Add, delete, modify, and query operations on XML data in Python XML (Extensible Markup Language) is a text format used to store and transmit data. In Python, we can use a variety of libraries to process XML data, the most commonly used of which is the xml.etree.ElementTree library. This article will introduce how to use Python to add, delete, modify and query XML data, and illustrate it through code examples. 1. Introduction of modules First, we need to introduce xml.etree.Eleme

See all articles