We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15114
    • 102 Posts
    Hi

    I try to add auto save functionnality to an extra of my own.

    Si I added

    ,save_action: 'mgr/myextra/updateFromGrid'
    ,autosave: true
    


    as specified here http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/developing-an-extra-in-modx-revolution/developing-an-extra-in-modx-revolution,-part-ii

    But the processor script doesn't seem to be called.

    My JS code:

    Boutique.grid.Categories = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            id: 'aip-boutique-grid-categories',
            url : Boutique.config.connectorUrl,
            baseParams: { 
        		action: 'mgr/category/getList',
        		parent: '0'
        	},  	 	 	 	 	 	 
        	fields: [ 'id', 'name'],
            paging: true,
            remoteSort: true,
            anchor: '97%',
            autoExpandColumn: 'name',
            save_action: 'mgr/category/updateFromGrid',
            autosave: true,
            columns: [ {
    			header : _('id'),
    			dataIndex : 'id',
    			sortable : true,
    			width : 15
    		}, {
    			header : _('aip_boutique.categories.name'),
    			dataIndex : 'name',
    			sortable : true,
    			editor : {
    				xtype : 'textfield'
    			}
    		} ],
            
            tbar: [{
                text: _('aip_boutique.categories.menu.create')
                ,handler: { xtype: 'aip-boutique-window-category-create', blankValues: true }
            }]
        });
        Boutique.grid.Categories.superclass.constructor.call(this,config)
    };
    


    and my processor (updatefromgrid.class.php) :

    <?php
    require_once (dirname(__FILE__).'/update.class.php');
    
    class CategoryUpdateFromGridProcessor extends CategoryUpdateProcessor {
    	
    	public function initialize() {
    		
    		$data = $this->getProperty('data');
    
    		if (empty($data)) {
    			return $this->modx->lexicon('invalid_data');
    		}
    		
    		$data = $this->modx->fromJSON($data);
    		
    		if (empty($data)) {
    			return $this->modx->lexicon('invalid_data');
    		}
    		
    		$this->setProperties($data);
    		$this->unsetProperty('data');
    
    		return parent::initialize();
    	}
    }
    
    return 'CategoryUpdateFromGridProcessor';
    


    Am I missing something ? All other edit functions (add, edit, remove) work.

    My configuration


    • MODX Version: 2.2.13-pl
    • PHP Version: 5.3.13
    • Database (MySQL, SQL Server, etc) Version: MySQL 5.5.24
    • Additional Server Info: Apache 2.2 (WAMP server)
    • Browser: Firefox 29

    Julien