PDA

View Full Version : how to reload a formPanel?



andredecotia
14 Dec 2010, 10:17 AM
Hey guys,
please how can I reload my formPanel?

andredecotia
14 Dec 2010, 10:23 AM
or reload the window is also important to me...

Ballsacian1
14 Dec 2010, 10:56 AM
http://dev.sencha.com/deploy/dev/docs/source/Container.html#method-Ext.Container-doLayout

andredecotia
14 Dec 2010, 11:27 AM
I am testing with
Ext.getCmp('store').reload(); but that shows on FireBug that store was not defined...

Ballsacian1
14 Dec 2010, 11:29 AM
I am testing with
Ext.getCmp('store').reload(); but that shows on FireBug that store was not defined...

Are you trying to call a form load operation to reload all of the values in a given form?

andredecotia
15 Dec 2010, 4:14 AM
not exactly, I just would like to know howto load this
var store = new Ext.data.JsonStore({ that's in an included
js. that's in an Java jsp by calling something like store.load() got it?

proofmoore
15 Dec 2010, 4:46 AM
try Ext.getCmp('panel_id').store.load();

andredecotia
15 Dec 2010, 5:00 AM
hi, I loved your clue, I tried out:


Ext.getCmp('images-view').getStore().reload();

and


Ext.getCmp('images-view').store.load();

but still not working...

I am trying to reload the following below:

function onDoubleClickDo(nomeDoThumb){

var trataNomeDoThumb = "thumb_50";
var recebeIdDoThumb = trataNomeDoThumb.substring("6","10");

var conn = new Ext.data.Connection();
conn.request({
url: 'enviaIdDoAutorParaAction.action',
params: {
'idImagem': recebeIdDoThumb
},
});

Ext.Msg.alert('Foto Principal da Pessoa', 'A Foto Clicada ' + 'thumb_'+recebeIdDoThumb + ' Foi Especificada Como Principal.');
}

Ext.onReady(function() {

/*Início da Galeria de Fotos*/
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'resultgaleria.action', method: 'POST'
}),
root: 'linhas',

fields: [
{name: 'idsDosThumbs', type: 'int'},
'nomesDosThumbs',
'urlFotoOriginal',
'urlsDosThumbs'
],

/*listeners: {
load: function(store){
store.data.each(function(item){
alert('urlsDosThumbs:' +urlsDosThumbs +' ID: '+item.get('idsDosThumbs'));
})
}
}*/
});
//store.load();

var tpl = new Ext.XTemplate(
'<tpl for=".">',
//'<div class="thumb-wrap" id="{nomesDosThumbs}">',
'<div class="thumb"><img src="{urlsDosThumbs}" title="{nomesDosThumbs}" ondblclick="onDoubleClickDo();"></div>',
'</tpl>',
'<div class="x-clear"></div>'
);

var tplDetail = new Ext.XTemplate(
'<div class="details">',
'<tpl for=".">',
'<img src="{urlsDosThumbs}"><div class="details-info">',

'<b>Nome da Foto:</b>',
'<span>{nomesDosThumbs}</span>',

'<span><a href="{urlFotoOriginal}" target="_blank">Ver Foto Original</a></span></div>',
'</tpl>',
'</div>'
);

var tbar = new Ext.Toolbar({
style: 'border:1px solid #99BBE8;'
});

var datav = new Ext.DataView({
autoScroll: true,
store: store,
tpl: tpl,
autoHeight: false,
height: 400,
multiSelect: true,
overClass: 'x-view-over',
itemSelector: 'div.thumb-wrap',
emptyText: 'Nao ha imagem para ser exibida.',
style: 'border:1px solid #99BBE8; border-top-width: 0',

plugins: [
new Ext.DataView.DragSelector(),
],

prepareData: function(data){
data.nomesDosThumbs = Ext.util.Format.ellipsis(data.nomesDosThumbs, 15);
return data;
},
click: {
fn: function() {
var selNode = datav.getSelectedRecords();
tplDetail.overwrite(panelRightBottom.body, selNode[0].data);
}
}
});

tbar.add('->', {
text: 'Remover Foto',
icon: 'imagens/cross.png',
handler: function() {
var records = datav.getSelectedRecords();
if (records.length != 0) {
var imgName = '';
for (var i = 0; i < records.length; i++) {
imgName = imgName + records[i].data.nomesDosThumbs + ';';
}
Ext.Ajax.request({
url: 'verImagemPeloId!excluiImagemUsandoIdImagemComoParametro.action',
method: 'post',
params: { linhas: idsDosThumbs},
success: function() {
store.load();
}
});
}
}
});


var panelLeft = new Ext.Panel({
id: 'images-view',
frame: true,
width: 550,
autoHeight: true,
layout: 'fit',
items: [tbar,datav]
});
panelLeft.render('galeriaDeFotos');
/*Fim Galeria de Fotos*/


/*Início Descrição das Fotos*/
var panelRightBottom = new Ext.Panel({
title: 'Detalhes da Foto',
frame: true,
width: 330,
height: 200,
id: 'panelDetail',
renderTo: 'detalheDaImagem',
tpl: tplDetail
});
/*Fim Descrição das Fotos*/

});

andredecotia
15 Dec 2010, 5:05 AM
I've tried out now with
Ext.getCmp('store').load(); but nothing...

andredecotia
15 Dec 2010, 5:06 AM
your suggestion nothing also...

christian130
15 Dec 2010, 6:11 AM
what????? a formpanel is a panel! i think the method/function u wanna do is
grid.getView().refresh()
grid stands for the formpanel or whatever that has a store into it

Animal
15 Dec 2010, 6:23 AM
It will take you an infinite amount of time to write a working application in this way.

Reading the documentation is actually faster than this.

http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.BasicForm&member=load

andredecotia
15 Dec 2010, 6:29 AM
let me copy and paste complete code that I am facing problem accessing:

I am trying to reload to do another resquest to resultgaleria.action.

Look at bellow please:

Ext.onReady(function() {

/*Início da Galeria de Fotos*/
var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'resultgaleria.action', method: 'POST'
}),
root: 'linhas',

fields: [
{name: 'idsDosThumbs', type: 'int'},
'nomesDosThumbs',
'urlFotoOriginal',
'urlsDosThumbs'
],

/*listeners: {
load: function(store){
store.data.each(function(item){
alert('urlsDosThumbs:' +urlsDosThumbs +' ID: '+item.get('idsDosThumbs'));
})
}
}*/
});
//store.load();

var tpl = new Ext.XTemplate(
'<tpl for=".">',
//'<div class="thumb-wrap" id="{nomesDosThumbs}">',
'<div class="thumb"><img src="{urlsDosThumbs}" title="{nomesDosThumbs}" ondblclick="onDoubleClickDo();"></div>',
'</tpl>',
'<div class="x-clear"></div>'
);

var tplDetail = new Ext.XTemplate(
'<div class="details">',
'<tpl for=".">',
'<img src="{urlsDosThumbs}"><div class="details-info">',

'<b>Nome da Foto:</b>',
'<span>{nomesDosThumbs}</span>',

'<span><a href="{urlFotoOriginal}" target="_blank">Ver Foto Original</a></span></div>',
'</tpl>',
'</div>'
);

var tbar = new Ext.Toolbar({
style: 'border:1px solid #99BBE8;'
});

var datav = new Ext.DataView({
autoScroll: true,
store: store,
tpl: tpl,
autoHeight: false,
height: 400,
multiSelect: true,
overClass: 'x-view-over',
itemSelector: 'div.thumb-wrap',
emptyText: 'Nao ha imagem para ser exibida.',
style: 'border:1px solid #99BBE8; border-top-width: 0',

plugins: [
new Ext.DataView.DragSelector(),
],

prepareData: function(data){
data.nomesDosThumbs = Ext.util.Format.ellipsis(data.nomesDosThumbs, 15);
return data;
},
click: {
fn: function() {
var selNode = datav.getSelectedRecords();
tplDetail.overwrite(panelRightBottom.body, selNode[0].data);
}
}
});

tbar.add('->', {
text: 'Remover Foto',
icon: 'imagens/cross.png',
handler: function() {
var records = datav.getSelectedRecords();
if (records.length != 0) {
var imgName = '';
for (var i = 0; i < records.length; i++) {
imgName = imgName + records[i].data.nomesDosThumbs + ';';
}
Ext.Ajax.request({
url: 'verImagemPeloId!excluiImagemUsandoIdImagemComoParametro.action',
method: 'post',
params: { linhas: idsDosThumbs},
success: function() {
store.load();
}
});
}
}
});


var panelLeft = new Ext.Panel({
id: 'images-view',
frame: true,
width: 550,
autoHeight: true,
layout: 'fit',
items: [tbar,datav]
});
panelLeft.render('galeriaDeFotos');
/*Fim Galeria de Fotos*/


/*Início Descrição das Fotos*/
var panelRightBottom = new Ext.Panel({
title: 'Detalhes da Foto',
frame: true,
width: 330,
height: 200,
id: 'panelDetail',
renderTo: 'detalheDaImagem',
tpl: tplDetail
});
/*Fim Descrição das Fotos*/

});