Hi Guys,
I ran into a trivial issue, in my app, I want to have a question bank with a set of Q&A for each specific subjects and want to have an individual Store for each subject. As all the question bank fields would be same, i would like to have a single Model and have all Stores follow that model. How can this be achieved or the best way to do it?
Now, the weird problem is when i implement - When i assign the store to the List, the store which is mentioned last in the declaration (app.js) shows up in data irrespective of the Store I load.
Code:
app.js
stores: ["Java","C","DBMS"],
My view:
xtype: "list",
store: Ext.getStore("C"),
itemTpl: '{id}. {q}',
Even though i pass C store, the q field from DBMS store gets loaded in the view but id (the question number) is equal to the no. of questions/records in C store, not DBMS store. My model and Store defs.
Code:
Model:
---------
Ext.define("IApp.model.Questions", {
extend: "Ext.data.Model",
config: {
idProperty: 'id',
fields: [
{ name: 'id', type: 'int' },
{ name: 'q', type: 'string' },
{ name: 'a', type: 'string' }
]
}
});
---------------------------------------------------------------------
Stores:
--------
Ext.define("IApp.store.C", {
extend: "Ext.data.Store",
config: {
model: "IApp.model.Questions",
data: [
{id:1, q:'This is 1st question for C language', a:'This is 1st answer for C language'},
------------------------------------------------------------------------------------------
Ext.define("IApp.store.DBMS", {
extend: "Ext.data.Store",
config: {
model: "IApp.model.Questions",
data: [
{id:1, q:'This is 1st question for Database', a:'This is 1st answer for Database'},