ExtJS (7)-form Tips

Source: Internet
Author: User

First, the form of the basic form

First, the form is a container, which can be used to store the display of various components, the form provides the validation of components in the form, and data acquisition methods to facilitate the form operation.


Ii. Layout of form

Layout: {type: ' table ', columns:2}

It is recommended to use table in the form to layout


Iii. verification and submission of form

The form submission has to be validated before

if (Me.form.isValid ()) {var obj = me.form.getFieldValues (); OBJ is the parameter object obtained in the form, and the object key value corresponds to the name} of each component.

Recommended ways to submit Ajax after validation

Ext.Ajax.request ({url:url,jsondata:obj,//submit to Background params:obj in object form,//submit to Background success:function (res) in parmas form) { PACTERA.LOGGER.SHOWMSG ("Save team success."); Me.callback (); Me.up (' window '). Close ();}});


Iv. Data loading for form

Ext.Ajax.request ({url: ' team?id= ' + me.teamid,success:function (res) {var responsetext = Arguments[0].responsetext;var Team = Ext.decode (responsetext), var teamrecord = new Pactera.model.Team (team),//through model instantiation to Recordme.form.loadRecord ( Teamrecord);//form loading record//Some special components need to be re-organized manually added}});


V. Set read-only when viewing details

You can set the disabled property of a form to true directly,

You can also set the ReadOnly property of each component under form to true,

var Setflagbyarr = function (arr) {for (var i in arr) {arr[i].setreadonly (true);}} var arr1 = form.query (' TextField '), var arr2 = form.query (' radio '), var arr3 = form.query (' checkbox '); Setflagbyarr (ARR1); Setflagbyarr (ARR2); Setflagbyarr (ARR3);


This article is from the "Snow July" blog, please be sure to keep this source http://xuepiaoqiyue.blog.51cto.com/4391594/1675696

ExtJS (7)-form Tips

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.