最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Create Extjs 4 grid actioncolumn with text? - Stack Overflow

programmeradmin2浏览0评论

how to create ExtJs 4 grid action column with text? this is my code

{
    xtype : 'actioncolumn',
    text : lang('publish'),
    width    : 100,
    tdCls: 'x-publish-cell',
    items : [{
         getClass : function(v, meta, rec) {
             if (rec.get('isPublished') == true) {
                 //this.items[0].tooltip = 'Test';
                 return 'y';
             } else {
                 return 'n';
             }
         }
     }

How to create ExtJs 4 grid action column with text?

how to create ExtJs 4 grid action column with text? this is my code

{
    xtype : 'actioncolumn',
    text : lang('publish'),
    width    : 100,
    tdCls: 'x-publish-cell',
    items : [{
         getClass : function(v, meta, rec) {
             if (rec.get('isPublished') == true) {
                 //this.items[0].tooltip = 'Test';
                 return 'y';
             } else {
                 return 'n';
             }
         }
     }

How to create ExtJs 4 grid action column with text?

Share Improve this question edited Nov 22, 2013 at 16:56 Darin Kolev 3,40913 gold badges33 silver badges47 bronze badges asked Jul 26, 2013 at 11:39 user2622564user2622564 631 silver badge3 bronze badges 2
  • You want it to be text with no image, or with an image? – Reimius Commented Jul 26, 2013 at 13:48
  • text with an image. like [the image][the text here] – user2622564 Commented Jul 26, 2013 at 14:49
Add a ment  | 

1 Answer 1

Reset to default 13

You can use the column's renderer. The trick is that Ext specifically hide a CSS rule to hide content of action columns:

.x-grid-cell-inner-action-col {
    line-height: 0;
    font-size: 0;
}

So you will have to pensate for that.

Example:

{
    xtype:'actioncolumn',
    renderer: function() {
        return 
            '<div style="float:right; font-size: 13px; line-height: 1em;">'
                + 'Hey!' 
            + '</div>'
    },
    items: [
        // ...
    ]
}

Here I've used inline style, but a custom CSS class would probably be better.

Now that allows you to add some text to the column. If what you want to achieve is to add some text per action item in the column, you'll have to override Ext.grid.column.Action#defaultRenderer.

发布评论

评论列表(0)

  1. 暂无评论