1. #71
    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 Ryan,

    Sorry for the delay. Yeah, like you illuded to the problem isn't with PHP's JSON parser, it's that what you're passing it is not valid JSON. In fact it's not JSON at all - it's JavaScript.

    You may just want to try echoing the javascript out followed by a die; command to skip the controller. return $this->renderText(...); may do what you need too. I've used a similar approach for Ext.Direct requests that I wanted to return a CSV file and it worked very well.

    I'm hesitant to change things within the plugin itself since it would stray from the API specifications defined by the ExtJS team.

    Let me know if any of the suggestions work out for you.

    Cheers,
    Dan

  2. #72
    Ext User
    Join Date
    Jan 2010
    Location
    France
    Posts
    2
    Vote Rating
    0
    .ben is on a distinguished road

      0  

    Default dsExtDirectPlugin + AIR

    dsExtDirectPlugin + AIR


    Hi,

    Is it possible to use dsExtDirectPlugin in an AIR/ExtJS application ? My AIR application can't find my DirectFn variable.

    Here is my GroupingStore object (the same i used for a xHTML application which works fine) :

    Code:
    store = new Ext.data.GroupingStore
        (
           {
               proxy: new Ext.data.DirectProxy
               (
                   {
                       paramsAsHash: true,
                       directFn: president.list,
                         api: {
                            create: president.create,
                            read: president.list,
                            update: president.update,
                            destroy: president.destroy
                        }
                   }
               ),
               autoLoad: true,
               writer: writer,
                autoSave: true,
               groupField:'partyname',
               sortInfo: { field: 'partyname', direction: 'ASC' },
               remoteSort:false,
               groupOnSort: true,
               remoteGroup: false,
               reader: new Ext.data.JsonReader
               (
                   {
                       idProperty: 'idpresident',
                        root: 'data',
                        fields: [{
                            name: 'idpresident',
                            type: 'int'
                        },
                            'firstname',
                            'lastname',
                        {
                            name: 'idparty',
                            type: 'int'
                        },
                        {
                            name: 'partyname',
                            type: 'string',
                            mapping: 'Party.name'
                        },
                        {
                            name: 'tookoffice',
                            type: 'date',
                            dateFormat: 'Y-m-d'
                        },
                        {
                            name: 'leftoffice',
                            type: 'date',
                            dateFormat: 'Y-m-d'
                        },
                        {
                            name: 'income',
                            type: 'float',
                            sortable:    true
                        }]
                   }
               )
           }
        );
    Has anybody ever tried?
    Thanks

  3. #73
    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


    Quote Originally Posted by .ben View Post
    Is it possible to use dsExtDirectPlugin in an AIR/ExtJS application?
    Hi Ben,

    If Air can work with Ext.Direct then it should be able to work just fine with dsExtDirectPlugin since the implementation is a compliant version of the Ext.Direct API Spec. I've never worked with Air but if you have success it'd be great to hear about it.

    Dan

  4. #74
    Ext User
    Join Date
    Jan 2010
    Location
    France
    Posts
    2
    Vote Rating
    0
    .ben is on a distinguished road

      0  

    Default


    OK thanks Dan.

    But my problem is more important than I thought (non sandbox AIR application, cross domain, ScriptTagProxy, ...)
    Anyway, if I find how use your GREAT plugin with an AIR application connected to a Symfony application hosted in a different domain I'll let you know.

    Ben

  5. #75
    Ext User
    Join Date
    Feb 2010
    Posts
    1
    Vote Rating
    0
    user_z is on a distinguished road

      0  

    Default


    Hi.

    What should be result of function for auto commit or cancel moving tree node?
    like this
    tree.on('beforemovenode', function(tree, node , oldParent, newParent, index) {
    Ext.Ajax.request({
    url: '/my-treenode-move',
    params: {
    nodeid: node.id,
    newparentid: newParent.id,
    oldparentid: oldParent.id,
    dropindex: index
    }
    });
    });



    tree.on('beforemovenode', function(tree, node, oldParent, newParent, index ) {
    treeapi.move({ nodeid: node.id, newparentid: newParent.id, oldparentid: oldParent.id, dropindex: index},
    function(result, e){
    ...
    });
    });

    in actions.class.php
    ...
    /**
    * move tree node
    *
    * @extdirect-enable
    * @extdirect-len 1
    */
    public function executeMove(sfWebRequest $request) {
    $id = $this->getRequestParameter('nodeid');
    $from = $this->getRequestParameter('oldparentid');
    $to = $this->getRequestParameter('newparentid');
    $dropindex = $this->getRequestParameter('dropindex');

    ...
    //$this->result['success'] = true;
    $this->result['success'] = false;
    return sfView::SUCCESS;
    }

  6. #76
    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 user_z,

    Use $this->getRequestParameter('_raw'); to take a look at the raw data - using _raw is best for use with Trees anyways since Ext JS's trees work very differently from the rest of their components with regards to requests/responses. If you var_dump() or print_r() the _raw data you can get a really good idea of what data is being passed.

    Dan

  7. #77
    Ext User
    Join Date
    Mar 2010
    Location
    Rouen
    Posts
    2
    Vote Rating
    0
    heidyz is on a distinguished road

      0  

    Default


    Hello,
    Thanks for this plugin.
    I meet some difficulties with a TreeLoader when adapting the extjs example to symfony 1.3.6.

    If i comment my action like this (1 parameter):
    PHP Code:
      /**
       * @extdirect-enable
       * @extdirect-len 1
       * @extdirect-method getTree
       */
      
    function executeGetTree($request) {
        
    $raw $request->getParameter('_raw');
        .... 
    I have this exception: Invalid argument supplied for foreach() in dsExtDirectController.class.php on line 147.
    Obviously, it's because parameters are not like "key/values".

    If I comment my action with @extdirect-len 0. There is no exception but no parameter indicates which node (id) is concerned.

    So what is the solution according to you ?


    I have temporarily modified dsExtDirectController.class.php in a quick & dirty way:
    PHP Code:
              //Parse object literals into key/val pairs
              
    try {
                foreach (
    $cdata->data[0] as $key => $val) {
                  
    $this->context->getRequest()->setParameter($key$val);
                }
              } catch (
    Exception $ex) {
                
    // nothing
              

    Thanks
    Heidy
    Last edited by heidyz; 19 Jul 2010 at 6:57 AM. Reason: additional info

  8. #78
    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 Heidy,

    I would be interested in seeing the request the tree is generating that is causing that error. I've worked with trees using the plugin without a problem. Regardless, I've made the following changes which should fix your issue:

    PHP Code:
    //Parse object literals into key/val pairs
    if(!empty($cdata->data[0]))
    {
      foreach (
    $cdata->data[0] as $key => $val)
      {
        
    $this->context->getRequest()->setParameter($key$val);
      }

    I've posted the change to the SVN repository so feel free to let me know if it's resolved your issue. Thanks for bringing this up.

    Cheers,
    Dan

  9. #79
    Ext User
    Join Date
    Mar 2010
    Location
    Rouen
    Posts
    2
    Vote Rating
    0
    heidyz is on a distinguished road

      0  

    Default


    Hello dancablam,
    Thanks but it does not work because $cdata->data[0] is not empty: it's just not an associative array.

    Here is my code for the treeloader:
    PHP Code:
        var tree = new Ext.tree.TreePanel({
          
    width'50%'
          
    height'80%'
          
    useArrowstrue
          
    autoScrolltrue
          
    region'center'
          
    linestrue // ne fonctionne pas !
          
    animatetrue
          
    masktruemaskConfig: { msg"Chargement ..." }
          , 
    root: {
            
    id'root',
            
    text'Root',
            
    expandedtrue
          
    }
          , 
    rootVisiblefalse
          
    loader: new Ext.tree.TreeLoader({
            
    directFnCentreVisite.getTree
            
    ,listeners: {
              
    beforeload: function(){tree.body.mask('Chargement''x-mask-loading');}
              , 
    load: function(){tree.body.unmask();}
            }
          })
     ... 
    and here is the post request that it produces (firebug):


    post.png

    I'm in vacation for 5 weeks so ...

    Thanks a lot for your help.
    Heidy

  10. #80
    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 Heidy,

    Thanks for the additional information. I changed the if(!empty(...)) code to:
    PHP Code:
    if(!empty($cdata->data[0]) && !is_scalar($cdata->data[0]))... 
    Let me know if that works for you. (Changes posted to SVN).

    Cheers,
    Dan