1. #51
    Ext JS Premium Member dancablam's Avatar
    Join Date
    Apr 2008
    Location
    Dallas, TX
    Posts
    134
    Vote Rating
    0
    dancablam is on a distinguished road

      0  

    Default


    Hi nicolx,

    First, I didn't see where you added the direct provider - perhaps you did so in another js file. If not - you'll need to make sure you're calling: Ext.Direct.addProvider(Ext.app.RPC_API); (Where Ext.app.RPC_API is make sure it matches the value in your extdirect_api.js if it's different).

    Aside from that - your 'action' should always start with a capital letter. In other words test.multiply should be Test.multiply

    Tweak those two things and let me know how that worked.

    Cheers,
    Dan

  2. #52
    Ext User
    Join Date
    Feb 2010
    Posts
    5
    Vote Rating
    0
    nicolx is on a distinguished road

      0  

    Default continue...

    continue...


    ok! i'm approaching to the solution...

    i added this call in the final js (example.js) script called from the templates "test/indexSuccess"

    Ext.Direct.addProvider(Ext.app.EXTDIRECT_API);

    if i don't wrong "Ext.app.EXTDIRECT_API" is the variable defined in the js script generated by your task right?!

    so on my view.yml i included in the order:

    [ext/adapter/ext/ext-base.js, ext/ext-all.js, extdirect_api.js]

    but i get another error!

    to give you a complete view of the scripts status i post generated file extdirect_api.js

    Code:
    Ext.app.EXTDIRECT_API = {"url":"\/extjsTestApp_dev.php","type":"rpc","actions":{"test":[{"name":"multiply","len":1}]}};
    Code:
    Ext.Direct.PROVIDERS[e.type] is not a constructor
    Ext.DomHelper=function(){var s=null,j=/^...b.stopEvent();this.completeEdit()}}}});
    ext-all.js (line 7)
    
    any ideas!?

  3. #53
    Ext JS Premium Member dancablam's Avatar
    Join Date
    Apr 2008
    Location
    Dallas, TX
    Posts
    134
    Vote Rating
    0
    dancablam is on a distinguished road

      0  

    Default


    Hi nicolx,

    I'd use FireBug to see exactly what the server is returning (in the console tab you should see a request made to your server after executing Test.multiply. Look and see what the response was.

    You may also want to change extjsTestApp_dev.php to extjsTestApp.php since the _dev may be generating the toolbar that symfony has in development mode and that will definitely mess things up. Instead use the debug flag (-d) when generating the API so that you can still see debug data but without symfony generating the toolbar.

    ~Dan

  4. #54
    Ext User
    Join Date
    Feb 2010
    Posts
    5
    Vote Rating
    0
    nicolx is on a distinguished road

      0  

    Default


    wow!
    it's running!!

    i'm going to learn something about extjs for create a complete symfony app!
    thank you for your contribution!

  5. #55
    Ext User
    Join Date
    Feb 2010
    Posts
    5
    Vote Rating
    0
    nicolx is on a distinguished road

      0  

    Cool


    i dan!

    please don't hate me

    i have another problem!
    I want to use sfGuardPlugin...
    I included it:

    Code:
    all:
      ds_ext_direct_plugin:
        include_plugins: [sfGuardPlugin]
    when i try to do
    Code:
    extdirect:generate-api frontend
    i get this error
    Code:
    Fatal error: Class 'BaseSfGuardUserGeneratorConfiguration' not found in /home/poldotz/workspace/em/trunk/plugins/sfGuardPlugin/modules/sfGuardUser/lib/sfGuardUserGeneratorConfiguration.class.php on line 11
    any ideas!?

    thanks in advance!!

  6. #56
    Ext User
    Join Date
    Feb 2010
    Posts
    1
    Vote Rating
    0
    buildero is on a distinguished road

      0  

    Default


    Hi nicolx.

    I have followed your example but I have the same problem. When I change the type to "rpc" gives me the same problem that you presented. This is my initial configuration:

    This is my configuration of App.yml

    Code:
    all:
      ds_ext_direct_plugin:
        # Optional. Only use this parameter if you intend to create a mod_rewrite our route to a different URL for your extdirect front controller.
        router_url: /extdirect.php
    
        # Optional. Namespace for direct actions (ex: myNs.myAction.myMethod();)
        #action_namespace: myNs
    
        # Optional. Set the javascript variable name for the js api spec (defaults to 'Ext.app.{YOUR_API_NAME}_API)
        js_var: Ext.app.EXTDIRECT_API
    
        # Optional. Set a provider_type (defaults to remoting)
        provider_type: remoting
    
        # Optional. List plugins who's action classes you want included in API generation (defaults to null)
        # ex: include_plugins: [sfGuardPlugin]
        #include_plugins: ~
    This is the dispatch:
    Code:
    JSON
    
    
    
     
    action
    "Test" 
    data
    [Object { number=10}] 
    method
    "multiply" 
    tid
    2 
    type
    "rpc"Source
    {"action":"Test","method":"multiply","data":[{"number":10}],"type":"rpc","tid":2}
    The type is 'rpc' but the deafult configuration is 'remoting'. This is the file code exdirect_api.js

    Code:
    Ext.app.EXTDIRECT_API = {"url":"\/extdirect.php","type":"remoting","actions":{"country":[{"name":"update","len":1}],"Test":[{"name":"multiply","len":1}]}};
    Note that the type is "remoting". The example will not send any error but also no satisfactory result.

    If I change the type in app.yml to "rpc" and execute the task, "exdirect:generate api" sends me the following error:

    Code:
    Ext.Direct.PROVIDERS[e.type] is not a constructor
    Ext.DomHelper=function(){var t=null,k=...lclick",this.onNodeDblClick,this)}}); 
     ext-all.js (line 7)
    
    Can you guide on how to resolve the problem?

    Cheers,
    Buildero

  7. #57
    Ext User
    Join Date
    Feb 2010
    Posts
    5
    Vote Rating
    0
    nicolx is on a distinguished road

      0  

    Default


    for me i founded a solution.. i removed sfGuardPlugin inclusion and if i want to use a sfGuardPlugin function i'm extracting them (for example execute signin) and attach extDirect comment in the header. this procedure is running.

    Unfortunatly i don't have full control of extjs/extdirect and plugin, so i can't help you to the specific problem

    i hope that Dan can help us

  8. #58
    Ext JS Premium Member oaugustus's Avatar
    Join Date
    May 2007
    Location
    Belo Horizonte, Brazil
    Posts
    66
    Vote Rating
    2
    oaugustus is on a distinguished road

      0  

    Default


    Thank you for this nice plugin. It's very useful for me. But I have an important question, the admin generator generate files in cache, I have created a custom theme for it, and this theme generate a automatic @extdirect-enable in my action methods, but extdirect-generateapi don't work because it was generated in cache folder. How to solve this problem?
    Otávio Augusto Rodrigues Fernandes
    Net On - Soluções Tecnológicas Ltda
    Desenvolvimento e Consultoria em ExtJS
    www.neton.com.br
    otavio@neton.com.br
    (31) 3075-7868

  9. #59
    Ext User
    Join Date
    Nov 2007
    Posts
    7
    Vote Rating
    0
    corpse_br is on a distinguished road

      0  

    Question


    Hi,

    here's an api generated by the plugin:
    Code:
    Ext.app.EXTDIRECT_API = {"url":"\/extdirect.php\/dsExtDirect\/router","type":"remoting","actions":{"media":[{"name":"multiply","len":1}]}};
    factories.yml:
    Code:
    all:
      extdirect:
         controller:
            class: dsExtDirectController
    app.yml:
    Code:
    all:
      ds_ext_direct_plugin:
         js_var: Ext.app.EXTDIRECT_API

    use:
    Code:
    Ext.Direct.addProvider(Ext.app.EXTDIRECT_API);
    Ext.onReady(function() {
            media.multiply({"number":1}, function(result, e){
                debugger;
                });
            });
    but Symfony is not correctly routing the URL.. I get a:
    POST http://127.0.0.1:9001/extdirect.php/dsExtDirect/router 404 Not Found
    {"action":"media","method":"multiply","data":[{"number":1}],"type":"rpc","tid":2}

    any ideas? (sf 1.4.3; ext 3.1.1)

  10. #60
    Ext JS Premium Member dancablam's Avatar
    Join Date
    Apr 2008
    Location
    Dallas, TX
    Posts
    134
    Vote Rating
    0
    dancablam is on a distinguished road

      0  

    Default


    Hi nicolx,

    Not sure why I haven't been getting emails that there have been more posts to this thread - sorry for appearing to have dropped off the map for the past couple weeks. Can you search your project for the class 'BaseSfGuardUserGeneratorConfiguration' and tell me if it exists and if so, what directory the file is in. Some of these plugins have magical classes that only materialize at runtime (a lot of these can be found in the admin generator) so it's impossible to load them which causes a problem. But if the file does in fact exist I might be able to come up with a means to locate and load it.

    Cheers,
    Dan