ãã®èšäºã§ã¯ãæ¢åã®ã³ãŒãããŒã¹ãæ°ããããŒãžã§ã³ã«ç§»æ€ãããšããã³ã³ããã¹ãã§ããã¬ãŒã ã¯ãŒã¯ã®å°è±¡ãäŒããããšããŸãã ãŸããèœãšãç©Žã䟿å©ãªïŒãããŠããã§ã¯ãªãïŒãã«ãããŒãžãžã®ãªã³ã¯ãå¿ããªãããã«ããŸãããã
Ext4ãããŒãã Ext3ãšã®äžäœäºææ§ã¯ãªããããããçš®é¡ã®æ°ããæ¹æ³è«ã課ããŠãããç°¡åãã«ããŠããŸãã Javascriptãã¬ãŒã ã¯ãŒã¯ã®Windows VistaïŒ stackoverflow.comã®ã³ã¡ã³ãã®1ã€ïŒ
ExtJS 4ã¯ã以åã®ããŒãžã§ã³ã®ãã¬ãŒã ã¯ãŒã¯ãšäºææ§ããããŸããã
ã€ãŸãããã¬ãŒã ã¯ãŒã¯ã®ä»ã®ããŒãžã§ã³çšã«äœæãããã¢ããªã±ãŒã·ã§ã³ã¯æ©èœããŸããïŒäºçŽ°ãªå Žåãé€ãïŒã ããã¯ã次ã®çç±ã§çºçããŸãã
- å€æŽãããã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£èŠä»¶
- ã¯ã©ã¹æ§é ãå€æŽãããŸãã
- APIã»ãã³ãã£ã¯ã¹ãéšåçã«å€æŽãããŸãã
ã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£
æãéèŠãªå€æŽã¯ã¢ãŒããã¯ãã£ã«é¢ãããã®ã§ããExtJS4ã¯ã¯ã©ã€ã¢ã³ãåŽã®MVCãã¿ãŒã³ã説ããŸããã ã³ã³ããŒãã³ãã®ãã¹ãŠã®ãããžãã¹ããžãã¯ãããã³ã³ãããŒã©ãŒãã®æ¬è³ªã«ããèŠèŠçãªã€ã³ã¿ãŒãã§ãŒã¹ãæäŸãããã®ã«ããå¿ èŠããããŸã-ããã¥ãŒãïŒãã¥ãŒïŒãäœæããŸãã ããŒã¿ãæäœããããžãã¯ã¯ããã¢ãã«ãã¬ã€ã€ãŒïŒä»¥åã¯Ext.data.Recordããã³Ext.data.Storeã¹ãã¬ãŒãžãšåŒã°ããŠããExt.data.ModelèªäœãçŽæ¥åç §ããïŒã«é 眮ããå¿ èŠããããŸãã
å®éããã¹ãŠã®èŠèŠçãªã³ã³ããŒãã³ã-ããã«ãããŒãã«ãããªãŒãªã©ã -ãããã¯ã代衚ãŸãã¯ãã®äžéšã§ããããšã®ç³è«è ã§ãã èŠèŠçãªã³ã³ããŒãã³ããåã蟌ãïŒéçŽããïŒæ©èœã¯ããã¥ãŒã¬ãã«ã§ã®ã¿å¯èœã«ãªããŸãããå®éãã³ã³ãããŒã©ãŒã¯ãã©ããã¬ã€ã€ãŒã«ååšããŸãã
è¡šçŸã¯ãã€ãã³ãã®ã¡ã«ããºã ã«ããç¶æ ã®å€åã«ã€ããŠãäžåããã«å ±åããŸãã
ãããžãã¹ã¿ã¹ã¯ãã®èŠ³ç¹ããéèŠãªã€ãã³ãã¯ãã³ã³ãããŒã©ãŒã§åŠçããå¿ èŠããããŸãã ãããè¡ãããã«ãåã³ã³ãããŒã©ãŒã«ã¯ããžãã¯ã³ã³ãããŒã« ïŒïŒã¡ãœããããããããã䜿çšããŠãã¥ãŒã®äžéšããçºçããã€ãã³ãããµãã¹ã¯ã©ã€ãããŸãã ã³ã³ãããŒã©ãŒã¯ã ComponentQueryãšåŒã°ããCSSã«äŒŒãæ§æã䜿çšããŠã誰ãã€ãã³ããåä¿¡ãããããäŒããŸã ã
Ext.define('My.controller.Header', { extend: 'Ext.app.Controller', //... init: function() { this.control({ 'button[action=help-toggle]': { scope: this, click: this.toggleHelp }, 'mainmenuview': { scope: this, afterrender: this.menuRendered } } ); }, toggleHelp: function () { //some actions }, menuRendered: function () { //some other actions } } );
次ã®ããšãç解ããããšãéèŠã§ãã
- åã³ã³ãããŒã©ãŒã¯äœ¿çšå¯èœãªãã¥ãŒããŒãå šäœã ãèŠãããããå€ãã®å Žåãéåžžã«ç¹å®ã®ãœã±ãããŸãã¯å®å šã«äžæã®ãã¿ã³ãå¿ èŠãªãã®ãæ£ç¢ºã«æå®ããå¿ èŠããããŸãããããã¯å¿ ãããç°¡åã§ã¯ãããŸããã
- controlïŒïŒã®ãã©ã¡ãŒã¿ãŒã§èšè¿°ãããComponentQueryã¯ãã€ãã³ãéžæã«ãŒã«ã§ãããåçã«åäœããŸãã ããã¯ããã¥ãŒããã®ã€ãã³ãã«ã€ããŠããã®ãã³ãã©ãŒãã³ã³ãããŒã©ãŒã§åŒã³åºãããšãã§ãããã©ãããã¢ããªã±ãŒã·ã§ã³ã決å®ããããšãæå³ããŸãã
ãããã£ãŠã以åã¯ç°¡åã«åå©çšã§ãã1ã€ã®ã³ã³ããŒãã³ãã«ã«ãã»ã«åãããŠãããã®ãããæèã®ãªããè¡šçŸã®ã»ãããã¢ãã«ã®ã»ãããã³ã³ãããŒã©ãŒã®ã»ãããªã©ãããã€ãã®ç°ãªãéšåã«åå²ãããããã«ãªããŸããã ããã¯ãéçã«å®çŸ©ãããèŠçŽ ãæã€å°ããªã¢ããªã±ãŒã·ã§ã³ã«ãšã£ãŠã¯æå©ã§ãããåçãªã³ã³ããŒãã³ãã®äœæã䌎ãããŒãžã«ãšã£ãŠã¯æ·±å»ãªå°é£ã§ãïŒãã®ãããªåé¡ã«ã€ããŠã¯ã ãã¡ããåç §ããŠãã ãã ïŒã
ã¯ã©ã¹ãšã³ã³ããŒãã³ã
ãã¬ãŒã ã¯ãŒã¯ã®4çªç®ã®ããŒãžã§ã³ã§ã¯ãæšæºã¯ã©ã¹ã®æ§é ãå€§å¹ ã«åèšèšãããŸããã ã¯ã©ã¹åèªäœãããç°¡æœã«ãªããã¯ã©ã¹éã®è·ååæ ãããææ ®æ·±ããªããŸããã
ããšãã°ãã¹ãã¢ã®ããŒã¿ã®èªã¿åã/æžã蟌ã¿ã®ããžãã¯ãExt.data.proxy.Proxyã«å®éã«ã«ãã»ã«åãããããšãå¬ããæããŸãã ïŒããšãã°ã以åã®RESTfulãµãŒããŒã§ã®äœæ¥ãåå®çŸ©ããã«ã¯ããããã·ãšãªããžããªèªäœã®å¯Ÿå¿ããã¡ãœããã®äž¡æ¹ããªãŒããŒã©ããããå¿ èŠããããŸããïŒ -ã¡ãœããonWriteãonReadãããã³onUpdateïŒã
ããã«ãã¹ãã¢ãJSONïŒJsonStoreïŒãXMLïŒXmlStoreïŒããŒã¿ã§åäœããããããŒãã«ã®ããŒã¿ãã°ã«ãŒãåã§ãããïŒGroupingStoreïŒãéžæããå¿ èŠããããããã3ã€ã®ã¯ã©ã¹ããã¹ãŠ1éå±€ã¬ãã«ã
å Žåã«ãã£ãŠã¯ããªããžã§ã¯ãã®åäœãããäºæž¬å¯èœã«ãªããŸããã ãã®ãããã³ã³ããŒãã³ããæç»ãããåïŒãrenderãã€ãã³ãã®åïŒã«ããã®ã¢ã€ãã ã³ã¬ã¯ã·ã§ã³ã¯MixedCollectionã¿ã€ãã§ããã 以åã®ããã«é åã§ã¯ãªãïŒäºçŽ°ã§ããçŽ æŽãããïŒãExt.grid.PanelããŒãã«ã¯ã¹ãã¬ãŒãžãåèµ·åããåŸã«éžæã®æ倱ãåå¥ã«åŠçããŸããã®ç¶æ³ã¯æåã§èšè¿°ããå¿ èŠããããŸããïŒã
ExtJS 4ã¯ãæšæºJavaScriptã¯ã©ã¹ã®ãããã¿ã€ããå€æŽããŸããã
ãããã£ãŠã以åã¯ãããã¿ã€ããè£å®ããŠããå®çšçãªé¢æ°ïŒFunctionãCreateDelegateïŒïŒãStringãFormatïŒïŒãArrayãIndexOfïŒïŒïŒã¯ãå¥ã ã®synlettonïŒExt.FunctionãBindïŒïŒãExt.StringãFormatïŒ ïŒããã³Ext.ArrayãindexOfïŒïŒãããããïŒã
APIã®å€æŽ
ã»ãšãã©ã®å Žåãã¡ãœããåãããç°¡æœã«ãªããŸããããå®éã«ã¯å€æŽãããŠããŸãã ãããã£ãŠãã¢ããªã±ãŒã·ã§ã³å ã®ãã¹ãŠãæ£ããæ©èœããŠããããšã確èªããããã«æéããããå¿ èŠããããŸãã ããšãã°ãSelectionModelã®selectionRowïŒïŒã¡ãœããã¯ãæ°ããselectïŒïŒãšäžèŽããããã«ãªããŸããã
äžå¿«ãªããšããïŒãªã¢ãŒãããŒã¿ãæäœãããªããžããªãæäœããã»ãã³ãã£ã¯ã¹ã¯å€§ããå€ãããŸããã ãµãŒããŒã«èŠæ±ããããã®ãã©ã¡ãŒã¿ãŒã®è¿œå ã»ãããè¿œå ããããã®ããã³ãã«ãããªããªã£ãããšãå€æãããšããç§ã¯é©ããŸããã setBaseParamïŒïŒãŸãã¯loadïŒparamsïŒã®é¡äŒŒç©ã¯ããæäŸãããŠããŸããã
åºç€ãšãªãProxyã¯ã©ã¹ã¯ã以åãšåæ§ã«ä»»æã®ãã©ã¡ãŒã¿ãŒã»ããã䜿çšã§ããŸãããStoreã¬ãã«ã§ã¯ãProxyã«äžããããå³å¯ã«å®çŸ©ãããããŒã»ããããããŸãã
UPDã³ã¡ã³ãã¯ãå®éã«è¿œå ã®ãã©ã¡ãŒã¿ãŒãæž¡ãããšãã§ããããšã瀺åããŠããŸãïŒè¿œå ããŠãããMrSLonoedã«æè¬ããŸãïŒã
æããã«ã setBaseParam ïŒïŒã¹ãã¢ã®ä»£æ¿ãšããŠããããããã£ã«ã¿ãŒãšãœãŒã¿ãŒïŒãã£ã«ã¿ãŒãšãœãŒã¿ãŒïŒããµããŒããããŠããŸãã ãããã®ãšã³ãã£ãã£ã¯ãããŒã«ã«ïŒæ¢åã®ããŒã¿ã»ããã§äœæ¥ããïŒãšãªã¢ãŒãïŒãã©ã¡ãŒã¿ãŒãšããŠãµãŒããŒã«éä¿¡ãããïŒã®äž¡æ¹ã§äœ¿çšã§ããŸãã ç¹åŸŽïŒãã£ã«ã¿ãŒããã³ãœãŒã¿ãŒã®å ŽåãHTTPãã©ã¡ãŒã¿ãŒãžã®ã·ãªã¢ã«åã®æè»ãªå¯èœæ§ã¯ãããŸããã ãã®ããããã£ã«ã¿ãŒã¯åžžã«æ¬¡ã®ããã«ã·ãªã¢ã«åãããŸã
mywebserver?{otherparams}&filters={your serialized filters}
{your serialized filters}
è¡å ã§ã®ã¿ãã£ã«ã¿ãŒã®ã·ãªã¢ã«åãå¶åŸ¡ã§ããŸãããæšæºã®æ¹æ³ã䜿çšãããšããã£ã«ã¿ãŒãã©ã¡ãŒã¿ãŒã
{your serialized filters}
ã§ããŸããã
ãã£ã«ã¿ãŒã䜿çšããŠã¯ãšãªã«ãã©ã¡ãŒã¿ãŒãè¿œå ããæ¹æ³ã®äŸã次ã«ç€ºããŸãã
Ext.define('My.proxy.Ajax', { extend: 'Ext.data.proxy.Ajax', alias: 'proxy.myajax', filterParam: '', getParams: function (params, operation) { params = this.callParent(arguments); var filters = operation.filters; if (this.filterParam === '' && filters && filters.length) { Ext.apply(params, this.encodeFilters(filters)) } return params; }, encodeFilters: function (filters) { var f, po = {}, i; for (i = 0; i < filters.length; ++i) { f = filters[i]; po[f.property] = f.value; } return po; } } );
UPDïŒéèŠãªè©³çŽ°ã«æ³šæããŠãã ãããããã©ã«ãã§ã¯ãè¿œå ããããã£ã«ã¿ãŒã¯ãªã¢ãŒããšããŒã«ã«ã®äž¡æ¹ã§æ©èœããŸãã ã€ãŸãããã£ã«ã¿ãŒãq = myValueããè¿œå ãããšããã®ãã£ã«ã¿ãŒã¯å¯Ÿå¿ããHTTPãã©ã¡ãŒã¿ãŒã«ã·ãªã¢ã«åãããŸãïŒããã¯é©åã§ããïŒããããŒãåŸã«ã¹ãã¢ã«é©çšãããŸãã ãŸããã¬ã³ãŒãããã¹ãŠåä¿¡ããããšãã«ãã¬ã³ãŒããæ¶å€±ããåå ãææ¡ããã«ã¯ãé·æéãããå ŽåããããŸãã ãããã£ãŠãStoreãã©ã¡ãŒã¿ãŒãèŠãŠãã ããã filterOnLoad ã
2çªç®ã®äžå¿«ãªç¬éãAJAXã«é¢é£ããŠããŸãã äœããã®çç±ã§ãExtJS4ã«ã¯ããªããžã§ã¯ããHTTPããŒå€ãã©ã¡ãŒã¿ãŒã®ã»ãããšããŠéä¿¡ããåçŽãªWriterã±ãŒã¹ããããŸããã ãã®å®è£ ã¯ç°¡åã§ããããå ç©ç©ã¯æ®ããŸãããïŒ
Ext.define('My.data.writer.Http', { extend: 'Ext.data.writer.Writer', alias : 'writer.http', writeRecords: function(request, data) { if (Ext.isArray(data)) { data = data[0]; } Ext.apply(request.params, data); return request; } } );
åçããŒãã£ã³ã°
ãã®ãã¬ãŒã ã¯ãŒã¯ã®æ°ããããŒãžã§ã³ã¯ãJSãªãœãŒã¹ïŒã¯ãã¹ãã¡ã€ã³ãå«ããããã«ã¯
file://
ãããã³ã«-ããšãã°ããã¡ã€ã«ã·ã¹ãã ããHTMLãã¡ã€ã«ãšããŠãã«ããéãããšãã§ããïŒãåçã«ããŒãããæ©èœãæäŸããŸãã ãã®ç¹ã§ãåã¯ã©ã¹ã§ã¯ããã®ã¯ã©ã¹ãäŸåããã¯ã©ã¹ãŸãã¯ããã±ãŒãžã®ååãæ瀺çã«ç»é²ããããšããå§ãããŸãã
ããã¯ãExt.requireïŒïŒãåŒã³åºãããã¯ã©ã¹å®£èšã®æ¬äœã§åãååã®ã»ã¯ã·ã§ã³ã䜿çšããããšã§å®è¡ãããŸãã
ãœãŒã¹ã®èªã¿èŸŒã¿ãæå¹ã«ãªã£ãŠããå Žåããã¹ãŠã®äŸåé¢ä¿ãæ£ããèæ ®ãããããã«ãExtJSã¯ã¯ã©ã¹ã°ã©ãã®æ£ããèªã¿èŸŒã¿ãä¿èšŒããŸãã
ãã¡ã€ã«ã·ã¹ãã å ã®ãœãŒã¹ã³ãŒãã®å Žæã«é¢é£ããæ°ããèŠä»¶ã¯ããã®æ©èœã«é¢é£ããŠããŸãïŒå®å šãªã¯ã©ã¹åã¯ããã¡ã€ã«ã·ã¹ãã å ã®ãã¡ã€ã«ã®å Žæãäžæã«æ±ºå®ããå¿ èŠããããŸãïŒããšãã°ãJavaãPHPã®Zend Frameworkã§ã®æ £ç¿ã§ãïŒã
ExtJSãœãŒã¹ã«ã¯ãããã€ãã®ãªãã·ã§ã³ããããŸãã
- ext-all-debug.js
- ext-all-debug-w-comments.js
- ext-all-dev.js
- ext-all.js
- ext-debug.js
- ext-dev.js
- ext.js
ååã«ãã¹ãŠã®æ¥å°ŸèŸãå«ãŸãªãExt * .jsãã¡ã€ã«ã¯ãåçããŒããæå¹ã«ãªã£ãŠãããœãŒã¹ã§ãã ãã®ãããªãªãœãŒã¹ã¯ããããã°ã¢ãŒãã§ã®ã¿äœ¿çšããå¿ èŠããããŸãã
ãšããã§ãã誀ã£ãŠãæå¹ã«ãããåçãªãªãœãŒã¹ã®èªã¿èŸŒã¿ã¯ãèªã¿èŸŒãŸãããªãœãŒã¹ã«æ§æãšã©ãŒãå«ãŸããŠããå Žåã®ããµã€ã¬ã³ããExtJSã¯ã©ãã·ã¥ã®å¥ã®åå ã§ãã ãã ãããŸã JSLintããã£ã³ã»ã«ãã人ã¯ããŸããã
ExtJSããªã³ã¯ããããã®åãªãã·ã§ã³ã®ç®æšã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã
ãœãŒã¹ãèªã¿ãåªç§ãªããã°ã©ããŒã«ãªããŸãããïŒ
ãæž èŽããããšãããããŸããã