-
21 Aug 2012 3:12 AM #1
Unanswered: Showing an image in a view, the MVC way
Unanswered: Showing an image in a view, the MVC way
given the example here (http://docs.sencha.com/ext-js/4-0/#!...n_architecture , section "Controlling the grid"), i see how fields from the current record are passed along to the view that edits the users.
given that example, how would i show an image that depends on a value of the record that gets passed to the view?
i can pass along a parameter in the controller while instantiating the view, likeand retrieve this parameter in the view viaCode:var view =Ext.widget('useredit', {someparam: 'somevalue'});
, but that doesn't seem very MVC compliant to me.Code:this.someparam
-
21 Aug 2012 11:32 AM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
The use of MVC is to organize your code and allow others to follow. This does not mean that you need to stop using basic methods in your code.
Your controller simply handles where the actions are called.
Scott.
-
21 Aug 2012 8:49 PM #3
erm ... ok. that's not what i ment.
i have a model like this
img_name is the path of the image I'm trying to show in the view. so by passing that path as parameter while instantiating the view I would do something already done by the commandCode:Ext.define('MM.model.Magnet', { extend: 'Ext.data.Model', fields: [ { name: 'id', mapping: '@id', type: 'int'}, 'title', 'contributor_id', 'img_name', 'city', 'notes', 'country_id', { name: 'country', sortType: 'asCountry', convert: lookupCountry }, { name: 'contributor', convert: lookupContributor } ] });what I'm really asking for is an easy way to do an image form component. sticking to the example from my first post, something likeCode:view.down('form').loadRecord(record);
Code:xtype: 'form', items: [ { xtype: 'textfield', name : 'name', fieldLabel: 'Name' }, { xtype: 'textfield', name : 'email', fieldLabel: 'Email' }, { xtype: 'imagefield', name : 'someimage', fieldLabel: 'An Image' } ]
-
21 Aug 2012 8:55 PM #4
this is what I'm looking for (just a stripped down version I can actually understand)
http://stackoverflow.com/questions/1...32203#10932203


Reply With Quote