1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    jacksparoow1 is on a distinguished road

      0  

    Default Unanswered: I Can't render tems Action Column

    Unanswered: I Can't render tems Action Column


    Hi

    Please can you tell me what's wrong in this code :

    I'm trying to extend Action Column with two Items.

    Try please to replace the code in code editor in this documentation url to see the problem :


    Ext.create('Ext.data.Store', {
    storeId:'employeeStore',
    fields:['firstname', 'lastname', 'seniority', 'dep', 'hired'],
    data:[
    {firstname:"Michael", lastname:"Scott"},
    {firstname:"Dwight", lastname:"Schrute"},
    {firstname:"Jim", lastname:"Halpert"},
    {firstname:"Kevin", lastname:"Malone"},
    {firstname:"Angela", lastname:"Martin"}
    ]
    });


    Ext.define('Ext.grid.column.Custom', {
    extend: 'Ext.grid.column.Action',
    alias: ['widget.customcolumn'],
    width: 50,
    items: [{
    xtype : 'button',
    icon: 'extjs/examples/shared/icons/fam/cog_edit.png', // Use a URL in the icon config
    tooltip: 'Edit',
    handler: function (grid, rowIndex, colIndex) {
    var rec = grid.getStore().getAt(rowIndex);
    alert("Edit " + rec.get('firstname'));
    }
    }, {
    xtype : 'button',
    icon: 'extjs/examples/restful/images/delete.png',
    tooltip: 'Delete',
    handler: function (grid, rowIndex, colIndex) {
    var rec = grid.getStore().getAt(rowIndex);
    alert("Terminate " + rec.get('firstname'));
    }
    }]
    });


    Ext.create('Ext.grid.Panel', {
    title: 'Action Column Demo',
    store: Ext.data.StoreManager.lookup('employeeStore'),
    columns: [
    {text: 'First Name', dataIndex:'firstname'},
    {text: 'Last Name', dataIndex:'lastname'},
    {
    xtype:'customcolumn',
    }
    ],
    width: 250,
    renderTo: Ext.getBody()
    });

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,592
    Answers
    541
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Take a look at the constructor for Action column:

    http://docs.sencha.com/ext-js/4-1/so...od-constructor

    It seems that it doesn't read the items from this, it just checks the config, so adding them to the prototype via Ext.define won't work. I can't think of a good reason why it does this, it should probably be changed.

    You're going to have to override the constructor and pass a suitable config to the original constructor to get it to work.

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,021
    Answers
    385
    Vote Rating
    183
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    I just found the same thing. BTW, width is also not read, but text is.

    Should we file this as a bug or as an enhancement request to have width, items, etc. read from 'this' in the definition?

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    110
    Answers
    1
    Vote Rating
    -2
    predator has a little shameless behaviour in the past

      0  

    Default


    Same drama here.. does anybody solve it?