search
HomeWeb Front-endJS TutorialCommonly used add, delete, modify and check operation codes in extJs_extjs

Copy code The code is as follows:





                                                                                                                                                                                                                              ;%@ 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
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
Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript: Exploring the Versatility of a Web LanguageJavaScript: Exploring the Versatility of a Web LanguageApr 11, 2025 am 12:01 AM

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

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)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools