extjs buttons in toolbar appearance
Asked Answered
S

6

6

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 windows toolbar options)

how do i make it look like a button in a form ??

Shermanshermie answered 13/10, 2010 at 13:11 Comment(0)
R
4

Try like this :

tbar: [
  { xtype: 'button', text: 'Button 1', cls:'x-btn-default-small' }
]
Reword answered 25/10, 2013 at 2:59 Comment(0)
C
1

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.

Camelopardus answered 23/10, 2013 at 16:54 Comment(1)
can you include more code? I tried this : },{ xtype: 'button', text: 'asfasdf', ctCls: 'x-btn-over' } and it didn't workLeukemia
E
1

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

{
    xtype: 'panel',
    items: {
        xtype: 'button',
        text : 'My button'
    }
}
Everick answered 30/3, 2016 at 19:47 Comment(0)
L
0

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.

Lashondra answered 22/6, 2011 at 13:41 Comment(0)
R
0

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.

Refectory answered 27/3, 2014 at 19:0 Comment(0)
G
0

For Erxjs 6:

baseCls: "x-btn-default-small",
Gauguin answered 27/6, 2024 at 11:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.