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