Results 1 to 3 of 3

Thread: getClass for actionColumn only in a few rows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
      0  

    Default getClass for actionColumn only in a few rows

    Hi, I'm using the code below, to set the css class for an action column.
    But even if the result is null, some elements are inserted by extjs.


    Code:
    getClass: function(v, meta, data) {        
          if (data.myDate < new Date())
                return null;
          else
                return 'insert';
      }
    html:

    Code:
    <img alt="" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" 
    class="x-action-col-icon x-action-col-1   null">

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Vote Rating
    91
      0  

    Default

    Hi larini,

    It's work for me see the sample example-
    Code:
    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.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:'actioncolumn',
    width:50,
    
    items: [{
    icon: 'extjs/examples/shared/icons/fam/cog_edit.png',  // Use a URL in the icon config
    tooltip: 'Edit',
    getClass:function(){
    return 'color';
    },
    handler: function(grid, rowIndex, colIndex) {
    var rec = grid.getStore().getAt(rowIndex);
    alert("Edit " + rec.get('firstname'));
    }
    },{
    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'));
    }
    }]
    }
    ],
    width: 250,
    renderTo: Ext.getBody()
    });?
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
      0  

    Default

    In your case, you are always returning "color" class for this column. In my case, I'm doing something like:

    Code:
    getClass: function () {
        if (....)
            return 'color';
        else
            return null;
    
    
    },

Tags for this Thread

Posting Permissions

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