json - How to store and recursively read ExtJS component like this? -


the layout below want implement in webpage. i'd store json-like file, question :

  1. how should store it, especially, lines of function stuff?strictly obeying json style, or else?
  2. after stored successfully, how set model?
  3. how can read ext.data.store recursively, or loop?

any suggestions appreciated. thanks.

{             'xtype': 'tabpanel',             'activetab': 0,             'width': 600,             'height': 250,             'plain': true,             'defaults' :{                 'autoscroll': true,                 'bodypadding': 10             },             'items': [{                     'title': 'normal tab',                     'html': "my content added during construction."                 },{                     'title': 'ajax tab 1',                     'loader': {                         'url': 'ajax1.htm',                         'contenttype': 'html',                         'loadmask': true                     },                     'listeners': {                         'activate': function(tab) {                             tab.loader.load();                         }                     }                 },{                     'title': 'ajax tab 2',                     'loader': {                         'url': 'ajax2.htm',                         'contenttype': 'html',                         'autoload': true,                         'params': 'foo=123&bar=abc'                     }                 },{                     'title': 'event tab',                     'listeners': {                         'activate': function(tab){                             settimeout(function() {                                 alert(tab.title + ' activated.');                             }, 1);                         }                     },                     'html': "i tab 4's content. have event listener attached."                 },{                     'title': 'disabled tab',                     'disabled': true,                     'html': "can't see me cause i'm disabled"                 }             ]        } 

you have store functions strings , parse them later, same way sencha architect does.

this snippet created sencha architect

"implhandler": [     "settimeout(function(){",     "   alert(tab.title + ' activated'); ",     "},1);" ] 

so have store code this

{     "xtype": "tabpanel",     "activetab": 0,     "width": 600,     "height": 250,     "plain": true,     "defaults" : {         "autoscroll": true,         "bodypadding": 10     },     "items": [{             "title": "normal tab",             "html": "my content added during construction."         },{             "title": "ajax tab 1",             "loader": {                 "url": "ajax1.htm",                 "contenttype": "html",                 "loadmask": true             },             "listeners": {                 "activate": "function(tab) {tab.loader.load();}"             }         },{             "title": "ajax tab 2",             "loader": {                 "url": "ajax2.htm",                 "contenttype": "html",                 "autoload": true,                 "params": "foo=123&bar=abc"             }         },{             "title": "event tab",             "listeners": {                 "activate": "function(tab){settimeout(function() {alert(tab.title + ' activated.');}, 1);"             }         },{             "html" : "i tab 4's content. have event listener attached."         },{             "title": "disabled tab",             "disabled": true,             "html": "can't see me cause i'm disabled"         }     ]  } 

after need create model each field , create parser render component later.

i don't know trying do, seems lot of work.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -