extjs buttons in toolbar appearance

前端 未结 5 1190

Hey, i have a small question really but something i cant seem to find out.

when i place a button in a extjs toolbar, it appears with a default apperance (like any wi

相关标签:
5条回答
  • 2021-01-12 18:18

    See this post on the Sencha forum Toolbar Button Style. I too found this styling of a button as text quite unintuitive for users. With just a few lines of CSS added to your ExtJs css master file you can change this appearance globally for your application.

    0 讨论(0)
  • 2021-01-12 18:30

    You have to wrap it in a panel, here is solution for Extjs 4.2.5

    {
        xtype: 'panel',
        items: {
            xtype: 'button',
            text : 'My button'
        }
    }
    
    0 讨论(0)
  • 2021-01-12 18:33

    Try like this :

    tbar: [
      { xtype: 'button', text: 'Button 1', cls:'x-btn-default-small' }
    ]
    
    0 讨论(0)
  • 2021-01-12 18:42

    This is pretty close to this: ExtJS Button Style Toolbar

    The answer I was looking for was found in that question:

    Adding

    ctCls: 'x-btn-over'
    

    to the button's config makes it actually look like a button. This is kind of a hack because this is essentially styling the toolbar button to appear like it's being hovered over, but in my case I decided this was good enough.

    edit: I haven't touched ExtJS since version 3, so it looks like this no longer works.

    0 讨论(0)
  • 2021-01-12 18:44

    Here is my solution(it works for extJs 3.3.3):

    For button add extra class, I named it as 'x-toolbar-grey-btn':

    xtype: 'button',
    id: 'processButton',
    text: 'Process',
    ctCls: 'x-toolbar-grey-btn'
    

    Styles for extra class, in separate CSS file:

    .x-toolbar-grey-btn .x-btn-tl{
        background-position: 0 0;
    }
    .x-toolbar-grey-btn .x-btn-tr{
        background-position: -3px 0;
    }
    .x-toolbar-grey-btn .x-btn-tc{
        background-position: 0 -6px;
    }
    .x-toolbar-grey-btn .x-btn-ml{
        background-position: 0 -24px;
    }
    .x-toolbar-grey-btn .x-btn-mr{
        background-position: -3px -24px;
    }
    .x-toolbar-grey-btn .x-btn-mc{
        background-position: 0 -1096px;
    }
    .x-toolbar-grey-btn .x-btn-bl{
        background-position: 0 -3px;
    }
    .x-toolbar-grey-btn .x-btn-br{
        background-position: -3px -3px;
    }
    .x-toolbar-grey-btn .x-btn-bc{
        background-position: 0 -15px;
    }
    .x-toolbar-grey-btn button{
        font-weight: bold;
    }
    

    Because Ext button images lay in the file '/ext-3.3.3/resources/images/default/button/btn.gif', I changed only background-position property. It looks like native button.

    0 讨论(0)
提交回复
热议问题