PDA

View Full Version : Reload d'un store



Nheil
27 Mar 2011, 11:03 PM
Hi everyone,

I have a dataStore:




var stoTicketsInfos = new Ext.data.Store({
storeId: 'stoTicketsInfos',
url: 'data/incidents/getInfosTicketSuivi.php',
remoteSort: true,
autoLoad: true,
method: 'POST',
baseParams: {
numAppel: numAppel
},
reader:
new Ext.data.JsonReader({
totalProperty: 'total',
root: 'ticket'
},
new Ext.data.Record.create([
{name: 'NomDemandeur', type: 'string'},
{name: 'PrenomDemandeur', type: 'string'},
{name: 'Fai', type: 'string'},
{name: 'Site', type: 'string'},
{name: 'LibelleObjet', type: 'string'},
{name: 'CodeObjet', type: 'string'},
{name: 'Signalisation', type: 'string'},
{name: 'Technologie', type: 'string'},
{name: 'Priorite', type: 'string'},
{name: 'Symptome', type: 'string'},
{name: 'Statut', type: 'string'},
{name: 'NumTicket', type: 'string'},
{name: 'DateFinPrevue', type: 'string'},
{name: 'DateCloture', type: 'string'},
{name: 'Cause', type: 'string'},
{name: 'Responsabilite', type: 'string'}


])
)
});



I use my store like that:



stoTicketsInfos.load({
params:{numAppel:numAppel},
callback:function(records){


var valueDemandeur = records[0].data.NomDemandeur;
var prenomDemandeur = records[0].data.PrenomDemandeur;
var FAI = records[0].data.Fai;
var Site = records[0].data.Site;
var valueObjet = records[0].data.LibelleObjet;
var signalisation = records[0].data.Signalisation;
var technologie = records[0].data.Technologie;
var priorite = records[0].data.Priorite;
symptome = records[0].data.Symptome;
symptome2 = records[0].data.Symptome;
statut = records[0].data.Statut;
var refTicketAI = numAppel;
var numTicket = records[0].data.NumTicket;
var dateFinPrevue = records[0].data.DateFinPrevue;
var dateCloture = records[0].data.DateCloture;
var cause = records[0].data.Cause;
var responsabilite = records[0].data.Responsabilite;
var codeObjet = records[0].data.CodeObjet;


document.getElementById('divSiteTest' + numAppel).innerHTML = valueDemandeur + " " + prenomDemandeur;
document.getElementById('divSite' + numAppel).innerHTML = FAI + " " + Site;
document.getElementById('divObjet' + numAppel).innerHTML = valueObjet;
document.getElementById('divTechno' + numAppel).innerHTML = technologie;
document.getElementById('divSignalisation' + numAppel).innerHTML = signalisation;
document.getElementById('divPriorite' + numAppel).innerHTML = priorite;
document.getElementById('divSymptome' + numAppel).innerHTML = symptome;
document.getElementById('divStatut' + numAppel).innerHTML = statut;
//document.getElementById('divNoAppel' + numAppel).innerHTML = refTicketAI;
document.getElementById('divNumTicketClient' + numAppel).innerHTML = numTicket;
//document.getElementById('divDateFin' + numAppel).innerHTML = dateFinPrevue;
document.getElementById('divCodeObjet' + numAppel).innerHTML = codeObjet;
document.getElementById('divPOP' + numAppel).innerHTML = POP;

<?php if($_GET['ticketClos'] == 1){ ?>

document.getElementById('divDateCloture' + numAppel).innerHTML = dateCloture;
document.getElementById('divCause' + numAppel).innerHTML = cause;
document.getElementById('divResponsabilite' + numAppel).innerHTML = responsabilite;

<?php } ?>
}
});



And i simply want to reload it when i press on a button.


stoTicketsInfos.reload();But this doesn't work, I have no error from my reload but information does not reload.

kohyea
28 Mar 2011, 12:38 PM
reload won't call the callback function, I suggest your try this:
stoTicketsInfos.on('load', yourCallback);