Hello peeps !
I have a problem getting my store to load after I get a JSON string from a PHP servlet.
My situation is : I have two panels - one with a search form in it, the other with a dataview where I would like to render the results I get.
On submit of the form, I perform a AJAX request from my search controller like so :
Code:
control : {
confirmButton:{
tap: function(list, index, element, record){
var myQueryConn = Ext.create('Ext.data.Connection');
myQueryConn.request({
params: {
'bGetQuery' : 1,
'bDecodeUTF8' : 1,
'bReverseCatLevels' : 1,
'strArchiveReference' : Ext.getCmp('strArchiveReference').getValue(),
'strFullText' : getSearchParams()
},
url:'servlets/search.php',
timeout:MAX_EXECUTION_TIME,
method:'POST',
success:function(response) {
Ext.getStore('Results').load(); //end of load
},
failure:function(responseObject) {
processResponseError(responseObject.status, 'searchArchive.php');
}
});
} //End of tap
}
}
And I get a JSON which looks like this :
Code:
{'totalCount':2,'rows':[{"id":"11","Host":"I-DEV-SBU","Path":"","SourceHost":"I-DEV-SBU","SourcePath":"Bonzai.pdf","DepotId":"1001","DepotKey":"00000007.pdf","Parent":"","Username":"","Filename":"","Extension":"","Filedate":"","Filesize":"","Importdate":"","Importtime":"","OCR":"","Fulltext":"","ValueDOC":""},{"id":"8","Host":"I-DEV-SBU","Path":"","SourceHost":"I-DEV-SBU","SourcePath":"Bonzai.pdf","DepotId":"1001","DepotKey":"00000005.pdf","Parent":"","Username":"","Filename":"","Extension":"","Filedate":"","Filesize":"","Importdate":"","Importtime":"","OCR":"","Fulltext":"","ValuePDF":""}]}
So I like to populate my store from this JSON string using :
Code:
Ext.getStore('Results').load();
However the load does nnot work. I tried a listener 'onLoad' of the store to see if I does anything but it doesn't 
Here is my results view panel :
Code:
Ext.define('Ext.ux.results', {
id: 'results',
xtype: 'results',
alias: 'results',
widget: 'widget.results',
extend: 'Ext.tab.Panel',
requires: [
'Ext.TitleBar',
'Ext.form.*',
'Ext.field.*',
'Ext.Button',
'Ext.data.ArrayStore'
],
config: {
defaults: {
scrollable: true
},
items: [
{
xtype:'dataview',
id:'searchResultList',
title: 'results',
iconCls:'info',
store: 'Results',
fullscreen: true,
disableSelection: true,
displayField:'id',
listConfig:{
itemTpl: new Ext.XTemplate('<div>{id}</div>')
},
store: Ext.create('Ext.data.Store', {
autoLoad: true,
storeId: 'Results',
model:'documind.model.Result',
proxy:{
type:'ajax',
url:'servlets/search.php',
method: 'POST',
reader:{
type:'json',
rootProperty:'rows',
totalProperty:'totalCount'
}
},
listener: {
onLoad: function(){
alert("Store has been loaded");
}
}
})
}
]// end of items
}
});
Any help is much appreciated. And I will send a great fat virtual hug to whoever can help me !
Thankssss
Sarah