Treegrid, Store : Récupérer le totalProperty dans le callback ?
Salut à tous,
Impossible de trouver quelque part comment récupérer la valeur de totalProperty de mon store dans mon appli !
Ma grille se remplit bien, tout fonctionne parfaitement sauf qu'impossible pour moi de trouver comment avoir le total qui est bien renvoyé par
ma requête JSON.
Auriez vous une idée à me soumettre car là je sais plus quoi faire !
j'ai tout testé.....mais surement pas assez :)
Voici mon appel:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| var myTree = Ext.create('Appli.view.patent.MyTreePanel');
myTree.getStore().load({
scope: this,
params: {
q: smartValues.tfsmartsearch,
rows: '10',
start: '0',
fl: 'pn,pd,fid',
group: 'true',
'group.field': 'fid'
},
callback: function(records, operation, success){
console.log('we searched: ' + smartValues.tfsmartsearch);
if(success){
console.log(records);
// COMMENT AVOIR ICI LA VALEUR getTotalCount ????
}
}
}); |
Mon store:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Ext.define('Appli.store.patent.Patents', {
extend: 'Ext.data.TreeStore',
model: 'Appli.model.patent.Patent',
autoLoad: false,
proxy: {
type: 'jsonp',
url: 'http://xxxx/cherche.php',
reader: {
type: 'json',
totalProperty: 'total', // si omit alors totalProperty prend aussi la valeur "total"
root: 'rows'
}
},
sorters: [{
property: 'pd',
direction: 'DESC'
}]
}); |
Mon Model:
Code:
1 2 3 4 5 6 7 8
| Ext.define('Appli.model.patent.Patent', {
extend: 'Ext.data.Model',
fields: [
{name: 'pn', type: 'string'},
{name: 'fid', type: 'string'},
{name: 'pd', type: 'date'}
]
}); |
et voici ma réponse JSON:
Code:
Ext.data.JsonP.callback1({"success":true,"total":30,"rows":[{"pn":"CN101700810B","pd":"2013-03-13T23:59:59Z","fid":"42155745",.....]}]});