{"id":869,"date":"2010-10-01T12:19:24","date_gmt":"2010-10-01T12:19:24","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=869"},"modified":"2010-10-30T07:18:18","modified_gmt":"2010-10-30T07:18:18","slug":"extjs%e5%9f%ba%e6%9c%ac%e8%af%ad%e6%b3%95","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/01\/extjs%e5%9f%ba%e6%9c%ac%e8%af%ad%e6%b3%95\/","title":{"rendered":"EXTJS\u57fa\u672c\u8bed\u6cd5"},"content":{"rendered":"<p>1\uff0c\u5f15\u5165\u6587\u4ef6\uff1a\u5e94\u7528extjs \u9700\u8981\u5728\u9875\u9762\u4e2d\u5f15\u5165extjs \u7684\u6837\u5f0f\u53caextjs \u5e93\u6587\u4ef6\uff0c\u6837\u5f0f\u6587\u4ef6\u4e3aresources\/css\/extall.css\uff0cextjs \u7684js \u5e93\u6587\u4ef6\u4e3b\u8981\u5305\u542b\u4e24\u4e2a\uff0cadapter\/ext\/ext-base.js \u53caext-all.js\uff0c\u5176\u4e2dext-base.js \u8868\u793a\u6846\u67b6\u57fa\u7840\u5e93\uff0cext-all.js \u662fextjs \u7684\u6838\u5fc3\u5e93<\/p>\n<p>2\uff0c \u63d0\u793a\u6846\u8c03\u7528\uff1aExt.Msg.alert(&#8220;\u63d0\u793a&#8221;,&#8221;\u987b\u63d0\u4f9b\u8ba2\u5355\u53f7\uff01&#8221;);? \u9700\u8981\u6ce8\u610f\u7684\u662f MessageBox \u5bf9\u8c61\u662f\u5f02\u6b65\u7684\u3002\u4e0d\u540c\u4e8e JavaScript\u4e2d\u539f\u751f\u7684alert\uff08\u5b83\u4f1a\u6682\u505c\u6d4f\u89c8\u5668\u7684\u6267\u884c\uff09\uff0c\u663e\u793a MessageBox \u4e0d\u4f1a\u4e2d\u65ad\u4ee3\u7801\u7684\u8fd0\u884c\u3002\u7531\u4e8e\u8fd9\u4e2a\u539f\u56e0\uff0c\u5982\u679c\u4ee3\u7801\u9700\u8981\u5728\u7528\u6237\u5bf9 MessageBox \u505a\u51fa\u53cd\u9988\u4e4b\u540e\u6267\u884c\uff0c\u5219\u5fc5\u987b\u7528\u5230\u56de\u8c03\u51fd\u6570 Ext.Msg.alert(&#8220;\u63d0\u793a&#8221;,&#8221;\u987b\u63d0\u4f9b\u8ba2\u5355\u53f7\uff01&#8221;, myfunction);<br \/>\nExt.Msg.show({<br \/>\ntitle:&#8217;Save Changes?&#8217;,<br \/>\nmsg: &#8216;You are closing a tab that has unsaved changes. Would you like to save your changes?&#8217;,<br \/>\nbuttons: Ext.Msg.YESNOCANCEL,<br \/>\nfn: processResult,? \/\/\u6267\u884c\u5b8c\u4e4b\u540e\u8981\u8c03\u7528\u7684\u51fd\u6570<br \/>\nanimEl: &#8216;elId&#8217;,<br \/>\nicon: Ext.MessageBox.QUESTION<br \/>\n});<br \/>\nfunction processResult(){<br \/>\nalert(&#8216;bbb&#8217;);<br \/>\n}<br \/>\n\u76f8\u5e94\u7684\u8fd8\u6709\uff1aconfirm\uff0cprompt<\/p>\n<p>3\uff0c\u521b\u5efa\u7ec4\u4ef6\uff1a<br \/>\nvar obj={title:&#8221;hello&#8221;,width:300,height:200,html:&#8217;Hello,easyjf open source&#8217;};<br \/>\nvar panel=new Ext.Panel(obj); panel.render(&#8220;hello&#8221;);? \/\/hello\u63a7\u4ef6\u7684ID\uff0c\u5c06\u5728ID\u4e3ahello\u7684\u63a7\u4ef6\u4e0a\u521b\u5efa\u4e00\u4e2a\u9762\u677f\uff0c\u6216\u76f4\u63a5\u5728obj\u5185\u7528renderTo\u6307\u5b9a\u3002<br \/>\n&lt;div id=&#8221;hello&#8221;&gt;&amp;nbsp;&lt;\/div&gt;<\/p>\n<p>\u5728api\u4e2d\u627e\u5230\u8981\u7528\u7684\u63a7\u4ef6\uff0c\u7528new\u521b\u5efa\uff0c\u8981\u4f20\u7684\u53c2\u6570\u7528obj\u5efa\u7acb\uff0c\u91cc\u9762\u5373\u662fapi\u6307\u793a\u7684\u5c5e\u6027\u3002\u6700\u540e\u901a\u8fc7render\u8f93\u51fa\u3002<br \/>\n\u5982\uff1anew Ext.Button({id:&#8221;btn&#8221;,text:&#8221;myButton&#8221;}).render(&#8220;hello&#8221;);<br \/>\nnew Ext.form.TextField({id:&#8221;btn&#8221;,value:&#8221;first&#8221;,width:200}) .render(&#8220;hello&#8221;);<\/p>\n<p>4\uff0c\u4e8b\u4ef6<br \/>\nExt.get(&#8220;btnAlert&#8221;).addListener(&#8220;click&#8221;,a);<br \/>\n\/\/\u4e3aID\u4e3abtnAlert\u7684\u63a7\u4ef6\u589e\u52a0click\u4e8b\u4ef6 a\u7b49\u540c\u4e8e\uff1adocument.getElementById(&#8220;btnAlert&#8221;).onclick=a;<br \/>\n\u5ef6\u8fdf\u5904\u7406\uff1aExt.get(&#8220;btnAlert&#8221;).on(&#8220;click&#8221;,a,this,{delay:2000});? \/\/\u4e3abtnAlert\u589e\u52a0a\u65b9\u6cd5\uff0c\u5ef6\u8fdf2\u79d2\u6267\u884c<\/p>\n<p>5,\u9762\u677f<br \/>\n\u9762\u677f\u7531\u4ee5\u4e0b\u51e0\u4e2a\u90e8\u5206\u7ec4\u6210\uff0c\u4e00\u4e2a\u9876\u90e8\u5de5\u5177\u680f\u3001\u4e00\u4e2a\u5e95\u90e8\u5de5\u5177\u680f\u3001\u9762\u677f\u5934\u90e8\u3001\u9762\u677f\u5c3e\u90e8\u3001\u9762\u677f\u4e3b\u533a\u57df\u51e0\u4e2a\u90e8\u5206\u7ec4\u4ef6\u3002<\/p>\n<p>6\uff0c\u7a97\u53e3<br \/>\nvar i=0;<br \/>\nfunction newWin()<br \/>\n{<br \/>\nvar win=new Ext.Window({title:&#8221;\u7a97\u53e3&#8221;+i++,<br \/>\nwidth:400,<br \/>\nheight:300,<br \/>\nmaximizable:true});<br \/>\nwin.show();<br \/>\n}<br \/>\nExt.onReady(function(){<br \/>\nExt.get(&#8220;btn&#8221;).on(&#8220;click&#8221;,newWin);<br \/>\n});<\/p>\n<p>7\uff0c\u5e03\u5c40<br \/>\nExtJS \u7684\u5bb9\u5668\u7ec4\u4ef6\u5305\u542b\u4e00\u4e2alayout \u53calayoutConfig \u914d\u7f6e\u5c5e\u6027\uff0c\u8fd9\u4e24\u4e2a\u5c5e\u6027\u7528\u6765\u6307\u5b9a\u5bb9\u5668\u4f7f\u7528\u7684\u5e03\u5c40\u53ca\u5e03\u5c40\u7684\u8be6\u7ec6\u914d\u7f6e\u4fe1\u606f\uff0c\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u5bb9\u5668\u7ec4\u4ef6\u7684layout \u5219\u9ed8\u8ba4\u4f1a\u4f7f\u7528ContainerLayout \u4f5c\u4e3a\u5e03\u5c40\uff0c\u8be5\u5e03\u5c40\u53ea\u662f\u7b80\u5355\u7684\u628a\u5143\u7d20\u653e\u5230\u5bb9\u5668\u4e2d\uff0c\uff0c\u5e38\u7528\u7684\u5e03\u5c40\u6709border\u3001column\u3001fit\u3001form\u3001card\u3001tabel\u7b49\u5e03\u5c40\u3002<br \/>\n\u4f7f\u7528\u65b9\u5f0f\uff1a\u6307\u5b9a\u5e03\u5c40\u65b9\u5f0f\uff0c\u6307\u5b9a\u4f4d\u7f6e\uff08\u53ef\u9009\uff09<br \/>\nExt.onReady(function(){<br \/>\nnew Ext.Panel({<br \/>\nrenderTo:&#8221;hello&#8221;,<br \/>\nwidth:400,<br \/>\nheight:200,<br \/>\nlayout:&#8221;column&#8221;,<br \/>\nitems:[{columnWidth:.5,<br \/>\ntitle:&#8221;\u9762\u677f1&#8243;},<br \/>\n{columnWidth:.5,<br \/>\ntitle:&#8221;\u9762\u677f2&#8243;}<br \/>\n]<br \/>\n});<br \/>\n\u6ce8\uff1aitems:\u4f20\u5165\u7684\u5355\u72ec\u4e00\u4e2a\u9879\uff0c\u5e94\u76f4\u63a5\u4f20\u5165\u4e00\u4e2a\u5bf9\u8c61\u7684\u5f15\u7528\uff08 \u5982items: {&#8230;}\uff09\u3002\u591a\u4e2a\u9879\u5e94\u4ee5\u6570\u7ec4\u7684\u7c7b\u578b\u4f20\u5165\uff08\u5982items: [{&#8230;}, {&#8230;}]\uff09\u3002<br \/>\n\u5982\uff1aitems:[<br \/>\n{fieldLabel:&#8221;\u8bf7\u8f93\u5165\u59d3\u540d&#8221;,name:&#8221;name&#8221;,xtype:&#8221;button&#8221;,text:&#8221;hello&#8221;},<br \/>\n\/\/\u7528xtype\u6307\u5b9a\u4f7f\u7528\u7684\u63a7\u4ef6\uff0c\u63a7\u4ef6\u7c7b\u578b\u4e3aExt.Componentxtype<br \/>\n{fieldLabel:&#8221;\u8bf7\u8f93\u5165\u5730\u5740&#8221;,name:&#8221;address&#8221;}] \/\/\u9ed8\u8ba4\u4e3atextbox<\/p>\n<p>1\uff09Column\u5e03\u5c40\uff1alayout:&#8221;column&#8221; \u5728items\u4e2d\u7528ColumnWidth\u6307\u5b9a\u5360\u636e\u7684\u5bbd\u5ea6\u5373\u53ef<br \/>\n2\uff09Border\u533a\u57df\u5e03\u5c40 \u3002\u8be5\u5e03\u5c40\u628a\u5bb9\u5668\u5206\u6210\u4e1c\u5357\u897f\u5317\u4e2d\u4e94\u4e2a\u533a\u57df\uff0c\u5206\u522b\u7531east\uff0csouth, west\uff0cnorth, cente\u6765\u8868\u793a<br \/>\nlayout:&#8221;Border&#8221; \u5728items\u4e2d\u7528region:&#8221;east&#8221; \u6307\u5b9a\u4f4d\u7f6e\u3002<br \/>\n3\uff09fit\u5e03\u5c40\uff1a\u81ea\u52a8\u7528\u5b50\u586b\u5145\u7236\u5bb9\u5668\uff0c\u4ee5\u7b2c\u4e00\u4e2a\u5b50\u4e3a\u4e3b\uff0c\u5176\u5b83\u52a0\u4e0a\u4e5f\u662f\u65e0\u7528\u3002<br \/>\n4\uff09 Form \u5e03\u5c40\u662f\u4e00\u79cd\u4e13\u95e8\u7528\u4e8e\u7ba1\u7406\u8868\u5355\u4e2d\u8f93\u5165\u5b57\u6bb5\u7684\u5e03\u5c40\uff0c\u8fd9\u79cd\u5e03\u5c40\u4e3b\u8981\u7528\u4e8e\u5728\u7a0b\u5e8f\u4e2d\u521b\u5efa\u8868\u5355\u5b57\u6bb5\u6216\u8868\u5355\u5143\u7d20\u7b49\u4f7f\u7528\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0cExt.form.FormPanel \u8fd9\u4e2a\u7c7b\u9ed8\u8ba4\u5e03\u5c40\u4f7f\u7528\u7684\u662fForm \u5e03\u5c40\uff0c\u800c\u4e14FormPanel\u8fd8\u4f1a\u521b\u5efa\u4e0e&lt;form&gt; \u6807\u7b7e\u76f8\u5173\u7684\u7ec4\u4ef6\uff0c\u56e0\u6b64\u4e00\u822c\u60c5\u51b5\u4e0b\u6211\u4eec\u76f4\u63a5\u4f7f\u7528FormPanel \u5373\u53ef\u3002<br \/>\nnew Ext.form.FormPanel({<br \/>\nrenderTo:&#8221;hello&#8221;,? \/\/\u6307\u5b9a\u8f93\u51fa<br \/>\ntitle:&#8221;\u5bb9\u5668\u7ec4\u4ef6&#8221;,<br \/>\nwidth:300,<br \/>\nlabelAlign:&#8221;right&#8221;,<br \/>\nheight:120,<br \/>\ndefaultType: &#8216;textfield&#8217;,<br \/>\nitems:[<br \/>\n{fieldLabel:&#8221;\u8bf7\u8f93\u5165\u59d3\u540d&#8221;,name:&#8221;name&#8221;},<br \/>\n{fieldLabel:&#8221;\u8bf7\u8f93\u5165\u5730\u5740&#8221;,name:&#8221;address&#8221;},<br \/>\n{fieldLabel:&#8221;\u8bf7\u8f93\u5165\u7535\u8bdd&#8221;,name:&#8221;tel&#8221;}<br \/>\n] }<br \/>\n);<br \/>\n});<br \/>\n5)Accordion \u5e03\u5c40\u7531\u7c7bExt.layout.Accordion \u5b9a\u4e49\uff0c\u540d\u79f0\u4e3aaccordion\uff0c\u8868\u793a\u53ef\u6298\u53e0\u7684\u5e03\u5c40\uff0c\u4e5f\u5c31\u662f\u8bf4\u4f7f\u7528\u8be5\u5e03\u5c40\u7684\u5bb9\u5668\u7ec4\u4ef6\u4e2d\u7684\u5b50\u5143\u7d20\u662f\u53ef\u6298\u53e0\u7684\u5f62\u5f0f,\u6709\u4e2a\u52a8\u6001\u7684\u4e0a\u4e0b\u5377\u52a8\u6548\u679c\u3002\u5728\u7a97\u53e3\u5c5e\u6027 layoutConfig \u4e2d\u6307\u5b9a\u5e03\u5c40\u914d\u7f6e\u53c2\u6570animate \u4e3atrue\uff0c\u8868\u793a\u5728\u6267\u884c\u5c55\u5f00\u6298\u53e0\u65f6\u662f\u5426\u5e94<br \/>\n\u7528\u52a8\u753b\u6548\u679c\u3002<br \/>\n6\uff09Table \u5e03\u5c40\uff0c\u8be5\u5e03\u5c40\u8d1f\u8d23\u628a\u5bb9\u5668\u4e2d\u7684\u5b50\u5143\u7d20\u6309\u7167\u7c7b\u4f3c\u666e\u901ahtml \u6807\u7b7e\u6392\u5217<br \/>\nExt.onReady(function(){<br \/>\nvar panel=new Ext.Panel({<br \/>\nrenderTo:&#8221;hello&#8221;,<br \/>\ntitle:&#8221;\u5bb9\u5668\u7ec4\u4ef6&#8221;,<br \/>\nwidth:500,<br \/>\nheight:200,<br \/>\nlayout:&#8221;table&#8221;,<br \/>\nlayoutConfig: {<br \/>\ncolumns: 3?? \/\/\u6307\u5b9a\u5217\u6570<br \/>\n},<br \/>\nitems:[{title:&#8221;\u5b50\u5143\u7d201&#8243;,html:&#8221;\u8fd9\u662f\u5b50\u5143\u7d201\u4e2d\u7684\u5185\u5bb9&#8221;,rowspan:2,height:100}, \/\/\u6307\u5b9a\u6bcf\u4e2a\u5360\u7528\u7684td<br \/>\n{title:&#8221;\u5b50\u5143\u7d202&#8243;,html:&#8221;\u8fd9\u662f\u5b50\u5143\u7d202\u4e2d\u7684\u5185\u5bb9&#8221;,colspan:2},<br \/>\n{title:&#8221;\u5b50\u5143\u7d203&#8243;,html:&#8221;\u8fd9\u662f\u5b50\u5143\u7d203\u4e2d\u7684\u5185\u5bb9&#8221;},<br \/>\n{title:&#8221;\u5b50\u5143\u7d204&#8243;,html:&#8221;\u8fd9\u662f\u5b50\u5143\u7d204\u4e2d\u7684\u5185\u5bb9&#8221;}<br \/>\n] }<br \/>\n);<br \/>\n});<\/p>\n<p>8\uff0c\u8868\u683c\u63a7\u4ef6\uff1a\u8868\u683c\u7531\u7c7bExt.grid.GridPanel \u5b9a\u4e49\uff0c\u7ee7\u627f\u81eaPanel\uff0c\u5176xtype \u4e3agrid\u3002ExtJS \u4e2d\uff0c\u8868\u683cGrid\u5fc5\u987b\u5305\u542b\u5217\u5b9a\u4e49\u4fe1\u606f\uff0c \u5e76\u6307\u5b9a\u8868\u683c\u7684\u6570\u636e\u5b58\u50a8\u5668Store \u3002\u8868\u683c\u7684\u5217\u4fe1\u606f\u7531\u7c7bExt.grid.ColumnModel \u5b9a\u4e49\u3001\u800c\u8868\u683c\u7684\u6570\u636e\u5b58\u50a8\u5668\u7531Ext.data.Store \u5b9a\u4e49\uff0c\u6570\u636e\u5b58\u50a8\u5668\u6839\u636e\u89e3<br \/>\n\u6790\u7684\u6570\u636e\u4e0d\u540c\u5206\u4e3aJsonStore\u3001SimpleStroe\u3001GroupingStore \u7b49\u3002<br \/>\n1\uff09\uff0c\u663e\u793a\u6570\u636e\uff0c\u6545\u8981\u6307\u5b9a\u6570\u636e\uff0c\u5728\u5c5e\u6027\u4e2d\u6709\u4e00store\uff0c\u7528\u6765\u6307\u5b9a\u6570\u636e\uff0c\u6b64\u5916\u8fd8\u6709\u6709\u5217\u540d\uff0c\u5217\u540d\u7528cm\u5b9a\u4e49<br \/>\nExt.onReady(function(){<br \/>\n\/\/\u6307\u5b9a\u6570\u636e<br \/>\nvar data=[ [1, &#8216;EasyJWeb&#8217;, &#8216;EasyJF&#8217;,&#8217;www.easyjf.com&#8217;],<br \/>\n[2, &#8216;jfox&#8217;, &#8216;huihoo&#8217;,&#8217;www.huihoo.org&#8217;],<br \/>\n[3, &#8216;jdon&#8217;, &#8216;jdon&#8217;,&#8217;www.jdon.com&#8217;],<br \/>\n[4, &#8216;springside&#8217;, &#8216;springside&#8217;,&#8217;www.springside.org.cn&#8217;] ];<br \/>\nvar store=new Ext.data.SimpleStore({data:data,fields:[&#8220;id&#8221;,&#8221;name&#8221;,&#8221;organization&#8221;,&#8221;homepage&#8221;]});<\/p>\n<p>\/\/\u6307\u5b9a\u5217\u540d<br \/>\nvar colM=new Ext.grid.ColumnModel([{header:&#8221;\u9879\u76ee\u540d\u79f0&#8221;,dataIndex:&#8221;name&#8221;,sortable:true},<br \/>\n{header:&#8221;\u5f00\u53d1\u56e2\u961f&#8221;,dataIndex:&#8221;organization&#8221;,sortable:true},<br \/>\n{header:&#8221;\u7f51\u5740&#8221;,dataIndex:&#8221;homepage&#8221;}]);<\/p>\n<p>\/\/\u521b\u5efa<br \/>\nvar grid = new Ext.grid.GridPanel({<br \/>\nrenderTo:&#8221;hello&#8221;,<br \/>\ntitle:&#8221;\u4e2d\u56fdJava\u5f00\u6e90\u4ea7\u54c1\u53ca\u56e2\u961f&#8221;,<br \/>\nheight:200,<br \/>\nwidth:600,<br \/>\ncm:colM,<br \/>\nstore:store,<br \/>\nautoExpandColumn:2<br \/>\n});<br \/>\n});<\/p>\n<p>9\uff0c\u53ef\u7f16\u8f91\u8868\u683c\u63a7\u4ef6EditorGridPanel\uff0c\u53ef\u7f16\u8f91\u8868\u683c\u662f\u6307\u53ef\u4ee5\u76f4\u63a5\u5728\u8868\u683c\u7684\u5355\u5143\u683c\u5bf9\u8868\u683c\u7684\u6570\u636e\u8fdb\u884c\u7f16\u8f91\uff0cExtJS \u4e2d\u7684\u53ef\u7f16\u8f91\u8868\u683c\u7531<br \/>\n\u7c7bExt.grid.EditorGridPanel \u8868\u793a\uff0cxtype \u4e3aeditorgrid\u3002\u4f7f\u7528EditorGridPanel \u4e0e\u4f7f\u7528\u666e\u901a\u7684GridPanel \u65b9\u5f0f\u4e00\u6837\uff0c\u533a\u522b\u53ea\u662f\u5728\u5b9a\u4e49\u5217\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u6307\u5b9a\u67d0\u4e00\u5217\u4f7f\u7528\u7684\u7f16\u8f91\u5373\u53ef\u3002<br \/>\nvar colM=new Ext.grid.ColumnModel([{<br \/>\nheader:&#8221;\u59d3\u540d&#8221;,<br \/>\ndataIndex:&#8221;name&#8221;,<br \/>\nsortable:true,<br \/>\neditor:new Ext.form.TextField()},<br \/>\n{header:&#8221;\u6027\u522b&#8221;,<br \/>\ndataIndex:&#8221;sex&#8221;<br \/>\n},<br \/>\n\u3002\u5f53\u5bf9\u4e00\u4e2a\u5355\u5143\u683c\u8fdb\u884c\u7f16\u8f91\u5b8c\u4e4b\u540e\uff0c\u5c31\u4f1a\u89e6\u53d1afteredit \u4e8b\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u6765\u5904\u7406\u5355\u5143\u683c\u7684\u4fe1\u606f\u7f16\u8f91\uff0c\u628a\u7f16\u8f91\u540e\u7684\u6570\u636e\u4fdd\u5b58\u5230\u670d\u52a1\u5668\u3002<\/p>\n<p>10\uff0c\u6570\u636e\u5b58\u50a8Stroe<br \/>\n1\uff09,record \uff0c\u4e00\u4e2aRecord \u53ef\u4ee5\u7406\u89e3\u4e3a\u5173\u7cfb\u6570\u636e\u8868\u4e2d\u7684\u4e00\u884c\uff0c\u4e5f\u53ef\u4ee5\u79f0\u4e3a\u8bb0\u5f55\u3002Record \u5bf9\u8c61\u4e2d\u5373\u5305\u542b\u4e86\u8bb0\u5f55\uff08\u884c\u4e2d\u5404\u5217\uff09\u7684\u5b9a\u4e49\u4fe1\u606f\uff08\u4e5f\u5c31\u662f\u8be5\u8bb0\u5f55\u5305\u542b\u54ea\u4e9b\u5b57\u6bb5\uff0c\u6bcf\u4e00\u4e2a\u5b57\u6bb5\u7684\u6570\u636e\u7c7b\u578b\u7b49\uff09\uff0c\u540c\u65f6\u53c8\u5305\u542b\u4e86\u8bb0\u5f55\u5177\u4f53\u7684\u6570\u636e\u4fe1\u606f\uff08\u4e5f\u5c31\u662f\u5404\u4e2a\u5b57\u6bb5\u7684\u503c\uff09\u3002<br \/>\nExt.onReady(function(){<br \/>\nvar MyRecord = Ext.data.Record.create([?? \/\/\u6307\u5b9a\u5217<br \/>\n{name: &#8216;title&#8217;},<br \/>\n{name: &#8216;username&#8217;, mapping: &#8216;author&#8217;},<br \/>\n{name: &#8216;loginTimes&#8217;, type: &#8216;int&#8217;},<br \/>\n{name: &#8216;lastLoginTime&#8217;, mapping: &#8216;loginTime&#8217;, type: &#8216;date&#8217;}<br \/>\n]);<br \/>\nvar r=new MyRecord({?? \/\/\u8d4b\u503c<br \/>\ntitle:&#8221;\u65e5\u5fd7\u6807\u9898&#8221;,<br \/>\nusername:&#8221;easyjf&#8221;,<br \/>\nloginTimes:100,<br \/>\nloginTime:new Date()<br \/>\n});<br \/>\nalert(MyRecord.getField(&#8220;username&#8221;).mapping);<br \/>\nalert(MyRecord.getField(&#8220;lastLoginTime&#8221;).type);<br \/>\nalert(r.data.username);<br \/>\nalert(r.get(&#8220;loginTimes&#8221;));<br \/>\n});<br \/>\n2\uff09 store:\u4e00\u4e2aStore \u5305\u542b\u591a\u4e2aRecord\uff0c\u540c\u65f6Store \u53c8\u5305\u542b\u4e86\u6570\u636e\u6765\u6e90\uff0c\u6570\u636e\u89e3\u6790\u5668\u7b49\u76f8\u5173\u4fe1\u606f\uff0cStore \u901a\u8fc7\u8c03\u7528\u5177\u4f53\u7684\u6570\u636e\u89e3\u6790\u5668(DataReader)\u6765\u89e3\u6790\u6307\u5b9a\u7c7b\u578b\u6216\u683c\u5f0f\u7684\u6570\u636e(DataProxy)\uff0c\u5e76\u8f6c\u6362\u6210\u8bb0\u5f55\u96c6\u7684\u5f62\u5f0f\u4fdd\u5b58\u5728Store \u4e2d\uff0c\u4f5c\u4e3a\u5176\u5b83\u63a7\u4ef6\u7684\u6570\u636e\u8f93\u5165\u3002<br \/>\n\u6570\u636e\u5b58\u50a8\u5668\u7531Ext.data.Store \u7c7b\u5b9a\u4e49\uff0c\u4e00\u4e2a\u5b8c\u6574\u7684\u6570\u636e\u5b58\u50a8\u5668\u8981\u77e5\u9053\u6570\u636e\u6e90(DataProxy)\u53ca\u6570\u636e\u89e3\u6790\u65b9\u5f0f(DataReader)\u624d\u80fd\u5de5\u4f5c<br \/>\nDataReader:<br \/>\nArrayReader Ext.data.ArrayReader\uff0d\u6570\u7ec4\u89e3\u6790\u5668\uff0c\u7528\u4e8e\u8bfb\u53d6\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u4fe1\u606f\uff0c\u5e76\u8f6c\u6362\u6210\u8bb0\u5f55\u96c6Record\u5bf9\u8c61<br \/>\nJsonReader? Ext.data.JsonReader\uff0dJson \u6570\u636e\u89e3\u6790\u5668\uff0c\u7528\u4e8e\u8bfb\u53d6JSON \u683c\u5f0f\u7684\u6570\u636e\u4fe1\u606f\uff0c\u5e76\u8f6c\u6362\u6210\u8bb0\u5f55\u96c6Record \u5bf9\u8c61<br \/>\nXmlReader??? Ext.data.XmlReader\uff0dXML \u6587\u6863\u6570\u636e\u89e3\u6790\u5668\uff0c\u7528\u4e8e\u628aXML \u6587\u6863\u6570\u636e\u8f6c\u6362\u6210\u8bb0\u5f55\u96c6Record\u5bf9\u8c61<br \/>\nDataProxy: DataProxy \u5b57\u9762\u89e3\u91ca\u5c31\u662f\u6570\u636e\u4ee3\u7406\uff0c\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\u6570\u636e\u6e90\uff0c\u4e5f\u5373\u4ece\u54ea\u513f\u6216\u5982\u4f55\u5f97\u5230\u9700\u8981\u4ea4\u7ed9DataReader \u89e3\u6790\u7684\u6570\u636e\u3002<\/p>\n<p>11 \u3001TreePanel<br \/>\nExt.onReady(function(){<br \/>\nvar root=new Ext.tree.TreeNode({<br \/>\nid:&#8221;root&#8221;,<br \/>\ntext:&#8221;\u6811\u7684\u6839&#8221;});<\/p>\n<p>root.appendChild(new Ext.tree.TreeNode({<br \/>\nid:&#8221;c1&#8243;,<br \/>\ntext:&#8221;\u5b50\u8282\u70b91&#8243;<br \/>\n}));<\/p>\n<p>var tree=new Ext.tree.TreePanel({<br \/>\nrenderTo:&#8221;hello&#8221;,<br \/>\nroot:root,<br \/>\nwidth:100? \/\/\u53ef\u7528loader: new Ext.tree.TreeLoader({url:&#8221;treedata.js&#8221;}), \u6765\u52a8\u6001\u52a0\u8f7d\u6570\u636e\uff0c\u6b64\u65f6root\u8981\u7528AsyncTreeNode\u7c7b\u578b<br \/>\n});<br \/>\n});<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\uff0c\u5f15\u5165\u6587\u4ef6\uff1a\u5e94\u7528extjs \u9700\u8981\u5728\u9875\u9762\u4e2d\u5f15\u5165extjs \u7684\u6837\u5f0f\u53caextjs \u5e93\u6587\u4ef6\uff0c\u6837\u5f0f\u6587\u4ef6\u4e3aresourc [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-869","post","type-post","status-publish","format-standard","hentry","category-extjs"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=869"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/869\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}