ExtJS: How to use alias/xtype to refer to other components -


i new in extjs , having in this fiddle simple application (which still not working) bind data store grid view. store like:

ext.define('extapp.store.bookstore',{         extend: 'ext.data.store',         model: 'extapp.model.bookmodel',         fields: ['title', 'author', 'price', 'qty'],         data: [....some data.....] }); 

and call store inside of view dont know how that, view looks like:

ext.define('extapp.view.bookview',{         extend: 'ext.grid.panel',         alias: 'widget.booklist',         title: 'book list',         store: **what should put here** }); 

one way found in internet can create store variable , put variable inside of view, like:

var bookstore = ext.create('extapp.store.bookstore'); bookstore.load(); 

and inside view: store: bookstore .

but ask how can use alias or xtype in case instead of creating store variable? tried putting inside of store: alias: 'store.bookstore' , inside view called: store: 'bookstore', didnt work. tried using: xtype: 'store.bookstore' , store: 'bookstore', still same result, not working.

and can please explain me difference between alias , xtype, in case should use alias, case should use xtype? thank you!

add storeid in store config , set stores:[yourstore] in app.js

sencha fiddle

extjs alias vs xtype

ext.onready(function(){      ext.define('extapp.model.bookmodel',{         extend: 'ext.data.model',         fields: [             {name: 'title', type: 'string'},             {name: 'author', type: 'string'},             {name: 'price', type: 'int'},             {name: 'qty', type: 'int'}         ]     });      ext.define('extapp.store.bookstore',{         extend: 'ext.data.store',         alias: 'store.bookstore',         storeid :'bookstore',         model: 'extapp.model.bookmodel',         fields: ['title', 'author', 'price', 'qty'],         data: [             { title: 'jdbc, servlet , jsp',              author: 'santosh kumar', price: 300, qty : 12000 },             { title: 'head first java',              author: 'kathy sierra', price: 550, qty : 2500 },             { title: 'java scjp certification',              author: 'khalid mughal', price: 650, qty : 5500 },             { title: 'spring , hinernate',              author: 'santosh kumar', price: 350, qty : 2500 },             { title: 'mastering c++',              author: 'k. r. venugopal', price: 400, qty : 1200 }         ]     });       ext.define('extapp.view.bookview',{         extend: 'ext.grid.panel',         alias: 'widget.booklist',         title: 'book list',         store: 'bookstore',         initcomponent: function(){             this.tbar = [{                 text: 'add book',                 action: 'add',                 iconcls: 'book-add'             }];              this.columns = [                 {                     header: 'title',                     dataindex: 'title',                     flex: 1                 },                 {                     header: 'author',                     dataindex: 'author'                 },                 {                     header: 'price',                     dataindex: 'price',                     width: 60                 },                 {                     header: 'quantity',                     dataindex: 'qty',                     width: 80                 }             ];             this.callparent(arguments);         }     });        ext.application({         name:'extapp',         stores: [         'extapp.store.bookstore'     ],         launch: function(){             ext.widget('booklist',{                 width: 800,                 height: 300,                 renderto: ext.getbody()             });         }     }); }) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -