Page 51 of 97 FirstFirst ... 41495051525361 ... LastLast
Results 501 to 510 of 965

Thread: [1.0] Grid RowActions Plugin

  1. #501
    Sencha Premium User allistar's Avatar
    Join Date
    May 2008
    Location
    Mount Maunganui, Bay of Plenty, New Zealand
    Posts
    42
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by jsakalos View Post
    If you need one handler just use event, not callbacks.
    Right you are - thanks.

  2. #502
    Touch Premium Member
    Join Date
    Feb 2009
    Posts
    9
    Vote Rating
    0
      0  

    Default

    To get it worked on 3.0 RC1 if modified Ext.ux.grid.RowActions.js:

    Code:
    -        // setup renderer
    -        if(!this.renderer) {
    -            this.renderer = function(value, cell, record, row, col, store) {
    -                cell.css += (cell.css ? ' ' : '') + 'ux-row-action-cell';
    -                return this.tpl.apply(this.getData(value, cell, record, row, col, store));
    -            }.createDelegate(this);
    -        }
    
    -    } // eo function init
    +    }, // eo function init
    +    
    +    renderer:function(v, p, record)
    +    {
    +        p.css += (p.css ? ' ' : '') + 'ux-row-action-cell';
    +        return this.tpl.apply(this.getData(v, p, record));
    +    }
    
    -    ,getData:function(value, cell, record, row, col, store) {
    +    ,getData:function(value, cell, record) {
    I don't know if this is the right way to do it and I've only tested it with static icons.

  3. #503
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    The real solution is much simpler:
    PHP Code:
        /**
         * @cfg {Boolean} isColumn
         * Tell ColumnModel that we are column. Do not touch!
         * @private
         */
        
    ,isColumn:true 
    Explanation: Ext 3.0 introduces grid columns that can be configured by xtypes and this flag tells column model that the column being process is column. In Ext 2.x there is no such flag so row actions were ignored in Ext 3.0.

    I have uploaded Ext 3.x compatible RowActions (devel version) so you can test it and give me some feedback as some other Ext 3.x issues may still be there.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  4. #504
    Sencha User
    Join Date
    May 2007
    Posts
    66
    Vote Rating
    0
      0  

    Default

    Everything seems to work except that I can't seem to get the callbacks to work. They're not firing when I click on any of the icons. I suspect that I'm probably doing something wrong.

    PHP Code:
    // JavaScript Document
    Ext.BLANK_IMAGE_URL '/js/ext/resources/images/default/s.gif';

    Ext.ns('App');

    App.SetStore = function(config) {
        var 
    config config || {};
        
    Ext.applyIf(config, {
            
    proxy: new Ext.data.HttpProxy({
                
    method'GET',
                
    url'/ajax/sets/list',
                
    listeners: {
                    
    beforeload: function(proxyparams) {
                        var 
    pager Ext.getCmp('pagebar');
                        var 
    total pager.store.getTotalCount();
                        var 
    start params.start || 0;
                        var 
    limit params.limit || pager.pageSize;
                        var 
    num Math.ceil((start limit) / limit);
                        
    proxy.conn.url proxy.url '/' num;
                        
    params = {};
                    }
                }
            }),
            
    reader: new Ext.data.JsonReader({
                
    idProperty'id',
                
    totalProperty'total',
                
    root'data'
            
    },
            [{
                
    name'id'
            
    },
            {
                
    name'name'
            
    },
            {
                
    name'sites'
            
    },
            {
                
    name'content'
            
    },
            {
                
    name'publish_date'
            
    }])
        });
        
    App.SetStore.superclass.constructor.call(thisconfig);
    };
    Ext.extend(App.SetStoreExt.data.Store);

    App.SetsGrid Ext.extend(Ext.grid.GridPanel, { // Override

        
    initComponent: function() { // rowactions
            
    this.actions = new Ext.ux.grid.RowActions({
                
    header'Actions',
                
    actions: [{
                    
    iconCls'icon-edit',
                    
    tooltip'Edit'
                
    },
                {
                    
    iconCls'icon-delete',
                    
    tooltip'Delete'
                
    },
                {
                    
    iconCls'icon-open',
                    
    tooltip'Open'
                
    }],
                
    callbacks: {
                    
    'icon-edit': function(gridrecordactionrowcol) {
                        
    console.log('callback fired, arguments: ' arguments);
                    },
                    
    'icon-delete': function(gridrecordactionrowcol) {
                        
    console.log('callback fired, arguments: ' arguments);
                    },
                    
    'icon-open': function(gridrecordactionrowcol) {
                        
    console.log('callback fired, arguments: ' arguments);
                    }
                }
            });

            
    this.store = new App.SetStore({
                
    id'setstore'
            
    });

            
    Ext.apply(this, {
                
    columns: [{
                    
    header"Id",
                    
    width50,
                    
    dataIndex'id',
                    
    sortabletrue
                
    },
                {
                    
    header"Name",
                    
    width200,
                    
    dataIndex'name',
                    
    sortablefalse,
                    
    menuDisabledtrue
                
    },
                {
                    
    header"Contents",
                    
    width200,
                    
    dataIndex'content',
                    
    sortablefalse,
                    
    menuDisabledtrue,
                    
    rendererthis.contentsRenderer
                
    },
                {
                    
    header"Sites",
                    
    width150,
                    
    dataIndex'sites',
                    
    sortablefalse,
                    
    menuDisabledtrue,
                    
    rendererthis.sitesRenderer
                
    },
                {
                    
    header"Publish Date",
                    
    width150,
                    
    dataIndex'publish_date',
                    
    sortabletrue
                
    },
                
    plugins: [this.actions],
                
    // Don't allow closing, hiding, moving, resizing or collapsing
                
    closablefalse,
                
    collapsiblefalse,
                
    enableColumnHidefalse,
                
    enableColumnMovefalse,
                
    enableColumnResizefalse,
                
    columnLinestrue,
                
    headerfalse,
                
    hideCollapseTooltrue,
                
    trackMouseOverfalse,
                
    // Disable selecting rows or cells - we don't need it
                
    disableSelectiontrue,
                
    //store : this.store,
                
    height600,
                
    plugins: [this.actions],
                
    bbar: new Ext.PagingToolbar({
                    
    id'pagebar',
                    
    pageSize20,
                    
    displayInfotrue,
                    
    displayMsg'Displaying sets {0} - {1} of {2}',
                    
    emptyMsg"No sets to display",
                    
    storethis.store
                
    })
            }); 
    // Call the superclass
            
    App.SetsGrid.superclass.initComponent.call(this);
        },
        
    // Render method for Contents
        
    contentsRenderer: function(valuemetaDatarecordrowIndexcolIndexstore) {
            var 
    image '<img border="0" src="/thumb/' value '/150" height="150" />';
            return 
    image;
        },
        
    // Render method for Sites
        
    sitesRenderer: function(valuemetaDatarecordrowIndexcolIndexstore) {
            var 
    sites '<ul class="sites-list">';
            for (
    0value.lengthx++) {
                
    sites += '    <li>' value[x] + "</li>\n";
            }
            
    sites += '</ul>';
            return 
    sites;
        },
        
    // Renderer for last row
        
    commandRenderer: function(valuemetaDatarecordrowIndexcolIndexstore) {}
    });
    Ext.reg('setsgrid'App.SetsGrid);

    Ext.onReady(function() {
        
    Ext.QuickTips.init();
        var 
    grid = new App.SetsGrid({
            
    renderTo'sets-grid',
            
    id'setgrid'
        
    });
        var 
    store grid.getStore();
        
    store.load();
    }); 
    The best advice I've been given ... Read the code.

  5. #505
    Sencha User
    Join Date
    May 2007
    Posts
    66
    Vote Rating
    0
      0  

    Default

    I've looked in to the code and it seems that the column id is not being generated for the rowaction plugin for 3.0.
    The best advice I've been given ... Read the code.

  6. #506
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    Redownload please and try it again. Grid column has to have an id in Ext 3 to be found. I've added one.

    Report please success or failure.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  7. #507
    Sencha User
    Join Date
    May 2007
    Posts
    66
    Vote Rating
    0
      0  

    Default

    Still failing to generate an id.

    This line.
    PHP Code:
    // the actions column must have an id for Ext 3.x
            
    this.id this.id || Ext.id(); 
    Should be.
    PHP Code:
    // the actions column must have an id for Ext 3.x
            
    this.id this.id || ++Ext.grid.Column.AUTO_ID
    Attached Images Attached Images
    The best advice I've been given ... Read the code.

  8. #508
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    Most likely you're still using an old version. Do you download the devel version from http://rowactions.extjs.eu? Or you need to clear browser's cache.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


  9. #509
    Sencha User
    Join Date
    May 2007
    Posts
    66
    Vote Rating
    0
      0  

    Default

    I did download the development version.

    Solving the problem of the id not being generated another one crops up. If you take a look at setConfig:

    PHP Code:
    setConfig : function(configinitial){
            if(!
    initial){ // cleanup
                
    delete this.totalWidth;
                for(var 
    0len this.config.lengthleni++){
                    var 
    this.config[i];
                    if(
    c.editor){
                        
    c.editor.destroy();
                    }
                }
            }

            
    // backward compatibility
            
    this.defaults Ext.apply({
                
    widththis.defaultWidth,
                
    sortablethis.defaultSortable
            
    }, this.defaults);

            
    this.config config;
            
    this.lookup = {};
            
    // if no id, create one
            
    for(var 0len config.lengthleni++){
                var 
    Ext.applyIf(config[i], this.defaults);
                if(!
    c.isColumn){
                    var 
    cls Ext.grid.Column.types[c.xtype || 'gridcolumn'];
                    
    = new cls(c);
                    
    config[i] = c;
                }
                
    this.lookup[c.id] = c;
            }
            if(!
    initial){
                
    this.fireEvent('configchange'this);
            }
        }, 
    Update: big woops

    The column is placed in this.lookup but the key is undefined for it resulting in the wrong column being passed to the callback.
    The best advice I've been given ... Read the code.

  10. #510
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    It all sounds strange. RowActions on my site now run against Ext 3.x and everything seems to work.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


Page 51 of 97 FirstFirst ... 41495051525361 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •