PDA

View Full Version : DirectJNgine and Directstore



gmaster_ck
22 Feb 2010, 4:17 AM
I am trying to realize a simple example with combobox and directstore. But I failed to pass the combobox value to the backstage function. Here is the code:


Ext.onReady(function(){

com.exttest.REMOTING_API.enableBuffer = 0;
Ext.Direct.addProvider( com.exttest.REMOTING_API);

var storetest = new Ext.data.DirectStore({
storeId:'test',
root:'results',
totalProperty:'total',
idProperty:'id',
fields:[
{name:'name'},
{name:'workid'},
{name:'title'}],
directFn:mainaction.queryperson,
paramsAsHash:true
});

var cmbStud = new Ext.form.ComboBox({
renderTo:'combo-div',
width:300,
mode:'remote',
store:storetest,
valueField: 'name',
displayField:'name',
minChars:1,
queryParam:'name',
triggerAction:'all',
hideTrigger:false,
pageSize:10
});
});

And the backstage handling function is:


public QueryRes queryperson(JsonObject params) {
System.out.println(params);
...............................
...............................(database read/write code)
}


The combobox can read from database properly, but I failed to pass any value into the backstage function through JsonObject params, whatever I typed in the combobox, what I read from println is just {}. I have been trapped for two days. Can anyone help me out? Thank you!!

I am using DirectJNgine to communicate with JAVA from extjs

Updated: If I use JsonArray instead of JsonObject, it works fine.