PDA

View Full Version : reload grid it wasn't work



chuvinha
16 Dec 2010, 8:37 AM
Hi guys, the reload from grid just it was work when the JSON isn't empty.
When the json is empty the grid keep with the previous date.



gridMidia.getStore().reload();


Could someone help me?

feyyaz
16 Dec 2010, 10:42 AM
if an empty result means no records to show, you can do different things

1st:
call removeAll before reload


gridMidia.getStore().removeAll();
gridMidia.getStore().reload();


but this could result in a flicker.

2nd:
on the load operation, add a callback for success and test the totalcount property, if it is zero you call removeAll

chuvinha
16 Dec 2010, 11:30 AM
It wasn't work feyyaz.
It appears error.



d is undefined
Ext.Resizable=Ext.extend(Ext.util.Obse...lclick",this.onNodeDblClick,this)}});

ext-all.js (linha 14)


I used

gridMidia.getStore().removeAll();
gridMidia.getStore().reload();


I didn't understand.

feyyaz
16 Dec 2010, 12:04 PM
please show some more code, but if

gridMidia.getStore().reload();

works, a call to

gridMidia.getStore().removeAll();

before it should do no harm, or result in an error.

chuvinha
17 Dec 2010, 3:13 AM
My code is so body:




function crudProduto(modo) {

// abre o popup sempre na primeira aba
tabPanel.setActiveTab('panelPrincipal');


//salvar
if(modo == 1){

// nome do popup e titulo
popupProdutos.setTitle('SGCS - Incluir Produto');


campoTitulo.enable();
campoTitulo.setValue('');

gridMidia.getStore().removeAll();
gridMidia.getStore().reload();
gridMidia.disable();

popupProdutos.show();


It is a popup with two tabs.
I take the second tab disable when the user create the product.
I just enable the second tab when the user modify the product.

christian130
17 Dec 2010, 6:17 AM
did u set the baseparams in the store as default params? if not u should give the reload or load method the params option. can u show some print screen?? it will help out