PDA

View Full Version : how to Refresh a View, after the store is updated



ci11111
26 Mar 2012, 7:26 AM
I have a View


var resultList = Ext.create('Ext.view.View', {
store: store,
tpl: [
'<tpl for=".">',
'<span> bldzlefef ',
'</span>',
'</tpl>'
],
itemSelector: 'span',
listeners: {
selectionchange: function(dv, nodes ){
var l = nodes.length,
s = l !== 1 ? 's' : '';
this.up('window').setTitle('Simple DataView (' + l + ' item' + s + ' selected)');
}
}
});

resultList.getStore().add(
{"publisherID":"uohfr",...}
);

var winResults = Ext.create('Ext.window.Window', {
collapsible: true,
animCollapse: true,
maximizable: true,
width: 750,
height: 300,
layout: 'fit',
items: resultList
});




the winResults shows, with nothing inside, whereas, the store has several items

JIMECKELS
26 Mar 2012, 7:39 AM
To refresh a view it is ..

resultList.getView().refresh() if I recall.

or perhaps just resultList.refresh();

Not sure if that is your issue however.

ci11111
26 Mar 2012, 8:24 AM
no, doesn't change anything,
I'm going to use a grid.Panel instead

mankz
26 Mar 2012, 8:32 AM
Normally you never have to tell the view to refresh itself. It knows when the store data changes etc. Maybe post a complete test case which shows your issue?

koutsenko
21 Jan 2014, 4:19 AM
I have same issue when assigning new server id to record after edit.Server response is valid json like that:
{ "success": "true", "values": [{ "id": 123, "values": [2,3,4,5], "name": "newname" }]}Root value of store proxy reader is 'values'.Visually, edited record changes, but i can't select it before view.refresh().And if I try to edit it again, edit AJAX-request will contain old id.How can I provide working example?If I use localstorage, like that http://jsfiddle.net/koutsenko/ht3LH/ , I can't see requests and responses.Thanks.