PDA

View Full Version : Extjs 3 and DwrProxy, how can i pass parameters to read method?



paoloyx
29 Mar 2010, 1:04 AM
Hi All,

it's my first post here, so i'd like to congratulate you on the GREAT work you're doing.
Hope there's someone here who can help me :)

I'm trying to setup DwrProxy (the v3 version found here: http://github.com/BigLep/ExtJsWithDwr) with ExtJs 3.1.1, however i can't understand how can i pass parameters when invoking a remote method.

For example, i've got this Java Class:



public interface CustomerManager {

List<Customer> searchCustomer(String name, String surname);

}
It's a simple interface that i'm exposing, with the help of Spring 3 and DWR. I can call this method with the page that DWR generates with success, obtaining the JSON that DWR generates for me.

I tried to setup this SimpleStore, with a proxy



var customerRecord = new Ext.data.Record.create([{
name : 'id',
type : 'string'
}, {
name : 'surname',
type : 'string'
}, {
name : 'name',
type : 'string'
}, {
name : 'birthDate',
type : 'date'
}]);

var customerStore = new Ext.data.SimpleStore({
proxy : new Ext.ux.data.DwrProxy({
apiActionToHandlerMap : {
read : {
dwrFunction : CustomerManager.searchCustomer
// Should i put here my parameters??
}
}
}),
reader : new Ext.data.JsonReader({
fields : customerRecord
})
});
I'd like in my code to call customerStore.load() passing somehow the name and surname of the customer that i'm searching for.
How can i do that?

I'm very new to ExtJs so please excuse me if i'me asking things that I already should know.

Thanks,

Paolo