PDA

View Full Version : facing problem while refreshing Ext.view.View - ExtjsV4.1.0



Ibrahimp
17 Jul 2012, 11:20 PM
Hi,

I want to refresh my View explicitily. Not able to do so. Below is the the code snippet.

var scriptDetailsGrid;
if (!scriptDetailsGrid) {

scriptDetailsGrid = Ext.create('Ext.view.View', {
// id: 'scriptDetailGrid',
store: CC.Repository.DataStore.GetScriptDetails(scriptId),
tpl: scriptTpl,
itemSelector: 'tr',
emptyText: 'No script selected.',
layout: { align: 'strech' }
});
}
else {

scriptDetailsGrid.store = CC.Repository.DataStore.GetScriptDetails(scriptId);
scriptDetailsGrid.refresh();
scriptDetailsGrid.getView().refresh(); //getting error
}

i am facing issue while refreshing in above code scriptDetailsGrid.getView().refresh();
Am loading the store with new data but view doesnt get refresh.

error : Microsoft JScript runtime error: Object doesn't support property or method 'getView'

please help.

Regards,
Ibrahim

Ibrahimp
18 Jul 2012, 2:46 AM
issue resolved - by clearing the panel first and then recreating view.:)

CC.Repository.UI.BuildScriptDetails = function (scriptId) {
var scriptTpl = new Ext.XTemplate(
'<table width="100%" border="0.5"; style="border-color: ##EDEDED;fontfamily:tahoma,arial,verdana,sans-serif;font-size:11px;" cellspacing="0" cellpadding="0" border="0">',
'<tpl for=".">',
'<tr>',
'<td>{key}</td>',
'<td>{value}</td>',
'</tr>',
'</tpl>',
'</table>'

);
if (scriptDetailsGrid) { //checking if View exist
Ext.getCmp('details-panel').removeAll(true); // clearing all items in this panel
}
scriptDetailsGrid = Ext.create('Ext.view.View', {
id: 'scriptDetailGrid',
store: CC.Repository.DataStore.GetScriptDetails(scriptId),
tpl: scriptTpl,
itemSelector: 'tr',
emptyText: 'No script selected.',
renderTo: Ext.getBody(),
layout: { align: 'strech' }
});
return scriptDetailsGrid;
};