I'm Using FontAwesome with ExtJS in my app.
All other buttons are working fine with font awesome when I do this:
iconCls: 'fa fa-edit'
But when using the same configuration in the actioncolumn (Component that allow you to put buttons on a Grid) the icon simply doesn't appear.
Does anyone have an idea why?
EDIT
After trying @qdev answer: I'm just seeing a ?#f040; text rendered (in blue).
The generated HTML for the action column button:
<span data-qtip="Edita registro" style="font-family:FontAwesome" class="x-action-col-icon x-action-col-glyph x-action-col-2 " title="" role="button">�xf040;</span>
CSS (Taken from firebug inspector):
element.style {
font-family: FontAwesome;
}
*, *:before, *:after {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: border-box;
}
.x-action-col-icon {
cursor: pointer;
height: 16px;
width: 16px;
}
.x-border-box, .x-border-box * {
box-sizing: border-box;
}
.x-action-col-glyph {
color: #9bc8e9;
font-size: 16px;
line-height: 16px;
width: 20px;
}
*, *:before, *:after {
box-sizing: border-box;
}
element.style {
text-align: center;
}
.x-grid-cell-inner-action-col {
font-size: 0;
line-height: 0;
}
.x-grid-cell-inner {
white-space: nowrap;
}
.x-grid-cell {
font: 11px/13px tahoma,arial,verdana,sans-serif;
}
.x-unselectable {
cursor: default;
}
.x-grid-table {
border-collapse: separate;
}
.x-unselectable {
cursor: default;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-panel-body-default {
color: black;
font-size: 12px;
}
.x-body {
color: black;
font-family: tahoma,arial,verdana,sans-serif;
font-size: 12px;
}
body {
color: #222222;
cursor: default;
font-family: "Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;
font-style: normal;
font-weight: normal;
line-height: 150%;
}
html, body {
font-size: 100%;
}
html, body {
font-size: 100%;
}
I've recently created this new app that will help you to prepare custom icons that you can assign to
iconCls
. It generates the_icons.scss
file for your Sencha apps. I've tested it with Sencha Touch only but I think it should also work with ExtJS. The README explains the steps for creating icons at the Ico Moon web site and using the tool to convert Ico Moon project files into SCSS for use in Sencha. It has also been tested with Sencha Architect Touch projects.If you use it for ExtJS please tell me if it works. Thanks.
You can simply return 'fa fa-edit' class from the actioncolumn item's getClass as following:
I add getGlyph (similar to getClass for icons) to qdev solution. It is very simple solution but works perfect.
Is is just 3 lines add do qdev solution:
Complete overrides code:
You can use it as simple as:
I hope this helps you ;)
This is because grid action column icons are rendered as
IMG
tags which accepts icon (path) as option.In order to be able to use this, you have to override
Ext.grid.column.Action
*defaultRenderer*
method, to support glyph config option beside icon (and on your code you can decide rather you go with iconimg
orglyph
for each action on any view).The working (tested on ExtJS 5.0.1 but I think it works on ExtJS 4 as well) code for this override:
If you don't know where to put or load it, you can find on the internet, but on a sencha cmd generated app you simply put it in
appFolder/overrides/grid/column/Action.js
and will automatically be loaded by the framework.Then you have to tweak a little bit some CSS as well (I added in my custom CSS for the main viewport). Without this you will NOT see the glyps, I suppose you'll understand why looking at the code bellow:
I have also succeeded to do another nice trick: hide action icons by default for all rows and show them only on the hovered row / record.
You can choose where to use this, only on the views that you wwant by using the getClass config function of the icon/glyph by adding
x-hidden-display
(on older ExtJS version might bex-hide-display
) class like this:... and then show all the icons for the hovered / selected row using CSS only:
I hope this helps you ;)
Looks like the overrides don't work if you are in 4.0 - 4.1. I went the path of least resistance and just made the icons into png format via http://fa2png.io/ then defined the assigned class to a background-image url in the css.