PDA

View Full Version : call a fuction in views



aniketharshe
16 Apr 2012, 1:31 PM
I have code:
homePages: [
{
title: '<span>'+configArr['about_text']+'</span><img src="resources/images/'+configArr['about_image']+'" class="nottodisplay" style="width:100px;">',
xtype: 'htmlPage',
url: 'data/about.html'
},
{
title: '<span>'+configArr['office_text']+'</span><img src="resources/images/'+configArr['office_image']+'" class="nottodisplay" style="width:100px;">',
xtype: 'htmlPage',
url: 'data/ouroffice.html'
},
{
title: '<span>'+configArr['service_text']+'</span><img src="resources/images/'+configArr['service_image']+'" class="nottodisplay" style="width:100px;">',
xtype: 'htmlPage',
url: 'data/service.html'

},
{
title: '<span>'+configArr['freeconsult_text']+'</span><img src="resources/images/'+configArr['freeconsult_image']+'" class="nottodisplay" style="width:100px;">',
xtype: 'htmlPage',
url: 'data/freeform.html'
}
]


this is in main app.js file....

i want to call a function which changes the values in the html pages given in the url how to do that?

dedoz
16 Apr 2012, 1:51 PM
assuming homePage is a property for a ext container decendant object
you can do


Ext.define ('myMainObject',{
extends : ' ... something like viewport '
initComponent : function()
{ this.homePages = [
{ title : 'some html like your expample',
url : this.url_first_page
},
..........................
];
this.callParent();
}
});

and when instantiating the component you can


Ext.create('myMainObject', {
url_first_page = 'some url ',
url_second_page = 'some url ',
.........
});