I am new in ExtJS and having in this fiddle a simple application (which still not working) that bind data from a store to a Grid view. My store look like:
Ext.define('ExtApp.store.BookStore',{
extend: 'Ext.data.Store',
model: 'ExtApp.model.BookModel',
fields: ['title', 'author', 'price', 'qty'],
data: [....some data.....]
});
And I would like to call this store inside of my View but I dont know how to do that, my View looks like:
Ext.define('ExtApp.view.BookView',{
extend: 'Ext.grid.Panel',
alias: 'widget.booklist',
title: 'Book List',
store: **WHAT SHOULD I PUT HERE**
});
One way that I found in the Internet is that I can create a store variable and put that variable inside of the View, like:
var bookstore = Ext.create('ExtApp.store.BookStore');
bookstore.load();
And then inside the View: store: bookstore
.
But I would like to ask that how can I use alias or xtype in this case instead of creating this store variable? I tried by putting inside of the Store: alias: 'store.bookstore'
and then inside the View I called: store: 'bookstore'
, but it didnt work. I also tried by using: xtype: 'store.bookstore'
and then store: 'bookstore'
, but still the same result, not working.
And can you please explain me what is the difference between alias and xtype, in which case should I use alias, which case should I use xtype? Thank you!