extjs4 - Aceess extjs viewmodel store in view -


how access , set store defined inside viewmodel? able set store created outside viewmodel. want keep store inside viewmodel , set store in view grid.

view

ext.define('myapp.view.sample.sample', { extend: 'ext.panel.panel',  requires: [     'myapp.view.sample.samplecontroller',     'myapp.view.sample.samplemodel' ],  xtype: 'app-sample', controller: 'sample',  viewmodel: {     type: 'sample' }, items: [{     xype: 'container',         items: [             {                 xtype: 'grid',                 store: 'sample', //this doesn't work. store undefined error thrown                 columns: [                     {                         text: 'name',                         dataindex: 'name'                     }                 ]             }            ]     } ] 

});

viewmodel

ext.define('myapp.view.sample.samplemodel', { extend: 'ext.app.viewmodel', alias: 'viewmodel.sample', stores: {     sample: {        // storeid: 'sample', //doesn't work if uncomment     fields: [ 'name' ],         data: [             { name: 'lisa' },             { name: 'bart' },             { name: 'homer',}         ]     } } }); 

you need bind store (which need properties taken viewmodel) , use correct "binding" notation http://www.sencha.com/forum/showthread.php?284474-viewmodel-stores-help

xtype: 'grid', bind: {     store: '{sample}' // curly braces if referencing viewmodel }, columns: [ ... ] 

you using extjs 5, correct? mention because 1 of tags 'extjs4' , viewmodels not introduced until extjs 5.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -