isibbot
18 Apr 2011, 7:05 AM
I realise that this question has been asked before, but there apears to be little definition I can find.
I have created an app using the mvc suggested in many of the videos and tuts. I cant seem to fathom how to link up the results of a store thats grabbing xml to a carousel, via a template.
My 'weak' attempt is below.
// The model
Ext.regModel("brochure.models.carouselData", {
fields: [
{name: 'content', type: 'string'},
]
//The Store
brochure.stores.carouselData = new Ext.data.Store({
model: 'brochure.models.carouselData',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'resource/xml/data.xml',
reader: {
type: 'xml',
record: 'page'
}
}
});
brochure.stores.carouselData.read();
});
//The template
tplSpreads = new Ext.Template(
'<img src="{content}" />'
)
//The View
brochure.views.FullSpreadView = Ext.extend(Ext.Carousel, {
layout: 'card',
tpl: tplSpreads,
initComponent: function() {
brochure.views.FullSpreadView.superclass.initComponent.apply(this, arguments);
},
})
The problems I' cant work out are...
Is stating the tpl: for the carousel enough to add the items: for the carousel?
Should I be looping though the store in the Ext.Template?
How do I upadate the brochure.views.FullSpreadView subclass? .update(storename) doesnt work.
If I try to update the Carousel with the template like
brochure.views.FullSpreadView.update(brochure.stores.carouselData);
I get an error
Uncaught TypeError: Object function (){ superclass.apply(this, arguments); } has no method 'update'
I appreciate that all the answers are probably in the api docs which I have spent several days reading and researchng. But I've gotten into a loop myself and cant seem to see the wood from the trees as it were.
Many thanks for any help in advanced.
I have created an app using the mvc suggested in many of the videos and tuts. I cant seem to fathom how to link up the results of a store thats grabbing xml to a carousel, via a template.
My 'weak' attempt is below.
// The model
Ext.regModel("brochure.models.carouselData", {
fields: [
{name: 'content', type: 'string'},
]
//The Store
brochure.stores.carouselData = new Ext.data.Store({
model: 'brochure.models.carouselData',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'resource/xml/data.xml',
reader: {
type: 'xml',
record: 'page'
}
}
});
brochure.stores.carouselData.read();
});
//The template
tplSpreads = new Ext.Template(
'<img src="{content}" />'
)
//The View
brochure.views.FullSpreadView = Ext.extend(Ext.Carousel, {
layout: 'card',
tpl: tplSpreads,
initComponent: function() {
brochure.views.FullSpreadView.superclass.initComponent.apply(this, arguments);
},
})
The problems I' cant work out are...
Is stating the tpl: for the carousel enough to add the items: for the carousel?
Should I be looping though the store in the Ext.Template?
How do I upadate the brochure.views.FullSpreadView subclass? .update(storename) doesnt work.
If I try to update the Carousel with the template like
brochure.views.FullSpreadView.update(brochure.stores.carouselData);
I get an error
Uncaught TypeError: Object function (){ superclass.apply(this, arguments); } has no method 'update'
I appreciate that all the answers are probably in the api docs which I have spent several days reading and researchng. But I've gotten into a loop myself and cant seem to see the wood from the trees as it were.
Many thanks for any help in advanced.