Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: User Extensions and Plugins

Reply
 
Thread Tools
  #1  
Old 01-22-2008, 03:32 PM
loeppky's Avatar
loeppky loeppky is offline
Ext User
 
Join Date: May 2007
Location: Seattle, WA
Posts: 228
loeppky is on a distinguished road
Default DwrProxy improved

This is for Ext 2.x. Please see http://www.extjs.com/forum/showthread.php?p=343185 for the Ext 3.x compatible release.

DwrProxy is now part of a larger ExtJsWithDwr project on GitHub (see form post).

What does this mean?
  • DWRProxy has been renamed to DwrProxy (although DWRProxy) is provided for backwards compatibility.
  • The code is publically available and easy to check out.
  • Official examples have been created that demonstrate DwrProxy in action. They're part of the GitHub project or can be seen here: http://biglep.s156.eatj.com/extJsWithDwrExamples/.
  • Now that all this overhead is taken care for DwrProxy, work on Ext 3.x support will come next week.


Where can I find the code?
http://github.com/BigLep/ExtJsWithDw...ta/DwrProxy.js


Why was this class created?
I found Axel's DWRProxy class in this thread a great starting point for enabling me to have a combobox load data through DWR. There were a couple of issues though that I experienced and saw in the original thread and others. Those issues were:
  1. Not compatible with Ext provided readers (e.g. ArrayReader and JSONReader).
  2. Arguments to the DWR function weren't guaranteed to be in the required order needed for the backend.

There were the additional minor issues that:
  1. The beforeload event wasn't "vetoable" like it was with every proxy.
  2. DWRProxy wasn't in the Ext.ux namespace.


Updates:
  • 2/21/08 - Fixed bug with exceptionHandler. Also corrected the spacing/indentation.
  • 3/7/08 - Fixed additional bug with exceptionHandler.
  • 3/12/08 - Fixed additional bug with exceptionHandler.
  • 5/24/09 - Renamed to DwrProxy (DWRProxy is added for backwards compatiblity) and posted project on GitHub.

Last edited by loeppky; 10-22-2009 at 01:27 PM.. Reason: Announced GitHub ExtJsWithDwrProject
Reply With Quote
  #2  
Old 01-22-2008, 03:37 PM
loeppky's Avatar
loeppky loeppky is offline
Ext User
 
Join Date: May 2007
Location: Seattle, WA
Posts: 228
loeppky is on a distinguished road
Default

Here
Reply With Quote
  #3  
Old 01-23-2008, 09:40 AM
Artem Artem is offline
Ext User
 
Join Date: Jan 2008
Posts: 4
Artem is on a distinguished road
Default

done like you wrote and got exception
Ext.ux.data has no properties
proxy: new Ext.ux.data.DWRProxy({

can you help ?
Reply With Quote
  #4  
Old 01-23-2008, 10:01 AM
Timido Timido is offline
Ext User
 
Join Date: Jan 2008
Posts: 5
Timido is on a distinguished road
Default dwr proxy how to use it to load data...

I have a DWR remote method that returns a List of Person [name, surname].
I'd like to show them in a GridPanel.

If I load the data thru a Store like this:

    var myReader = new Ext.data.ArrayReader({}, [
        {name: 'name'},
        {name: 'surname'}
    ]);

    var myStore = new Ext.data.Store({
            data: myPeople,
            reader: myReader
        });
it works fine.

But if I use a proxy like this:

var dwrproxy = new Ext.ux.data.DWRProxy({
                    dwrFunction: MyDwrService.getPersone,
                    listeners: {
                        'beforeload': function(dataProxy, params){}
                    }
                });

It does not work, that is, the grid gets rendered, but without any data.
I see the people data list coming from the server passing thru my firfox firebug, and actually the the server gets called.

What is wrong?
I tried to use both this version of DwrProxy and the previous posted one, but none of them seems to work properly. Where am I wrong at ?

thank you
Reply With Quote
  #5  
Old 01-23-2008, 01:44 PM
loeppky's Avatar
loeppky loeppky is offline
Ext User
 
Join Date: May 2007
Location: Seattle, WA
Posts: 228
loeppky is on a distinguished road
Default

Quote:
Originally Posted by Artem View Post
done like you wrote and got exception
Ext.ux.data has no properties
proxy: new Ext.ux.data.DWRProxy({
Artem, the fact that "Ext.ux.data has no properties" suggests that you didn't create the namespace. Did you copy the first line of the DWRProxy class post: "Ext.namespace("Ext.ux.data");"?
Reply With Quote
  #6  
Old 01-23-2008, 02:11 PM
loeppky's Avatar
loeppky loeppky is offline
Ext User
 
Join Date: May 2007
Location: Seattle, WA
Posts: 228
loeppky is on a distinguished road
Default

Timido,

What is the method signature of MyDwrService.getPersone? What parameters does it take, and what does it return?

Also, note that your "beforeload" listener in the DWRProxy isn't doing anything, and thus is unnecessary.
Reply With Quote
  #7  
Old 01-23-2008, 10:52 PM
SmartChow SmartChow is offline
Ext User
 
Join Date: Jan 2008
Posts: 5
SmartChow is on a distinguished road
Default

Great job!
but i have some troubles
could you tell me how to pass param by queryParam
how to use the property of queryParam
thanks
Reply With Quote
  #8  
Old 01-24-2008, 01:07 AM
Artem Artem is offline
Ext User
 
Join Date: Jan 2008
Posts: 4
Artem is on a distinguished road
Default

fix my exception, was in wrong path to dwrproxy.js.
cound you also say can i put data in GridPanel? with proxy
Reply With Quote
  #9  
Old 01-24-2008, 04:36 AM
Timido Timido is offline
Ext User
 
Join Date: Jan 2008
Posts: 5
Timido is on a distinguished road
Default

Quote:
Originally Posted by loeppky View Post
Timido,

What is the method signature of MyDwrService.getPersone? What parameters does it take, and what does it return?

Also, note that your "beforeload" listener in the DWRProxy isn't doing anything, and thus is unnecessary.
hi, here is the method sign:

    public List getPersone() {

        List persone = new ArrayList();
        
        Persona p1 = new Persona("john", "smith");
        Persona p2 = new Persona("andy", "garcia");
        Persona p3 = new Persona("ricky", "martin");
        Persona p4 = new Persona("ricky", "martin");
        persone.add(p1);
        persone.add(p2);
        persone.add(p3);
        persone.add(p4);
        
        log.info("GET PERSONE");
        return persone;

    }
I cant get the list to be loaded into the grid
Thank you for any hints
Reply With Quote
  #10  
Old 01-24-2008, 05:33 PM
loeppky's Avatar
loeppky loeppky is offline
Ext User
 
Join Date: May 2007
Location: Seattle, WA
Posts: 228
loeppky is on a distinguished road
Default

Quote:
Originally Posted by SmartChow View Post
could you tell me how to pass param by queryParam
how to use the property of queryParam
SmartChow: this is real easy to do. In the original example, if you defined your combobox to have a queryParam of 'differentQueryParam', then the "beforeload" listener would look like:

'beforeload': function(dataProxy, params){
	// setting the args that will get passed to the DWR function
	params[dataProxy.loadArgsKey] = ['loeppkyIsMyUserId', params.differentQueryParam]; 
}
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 12:32 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.