jQuery UI Widgets › Forums › Grid › jqxGrid Font-Awesome Buttons
Tagged: angular grid, cellsrenderer, Columntype: button, div, Font, Font Awesome, grid, icon, jquery grid, jqxgrid, span
This topic contains 4 replies, has 2 voices, and was last updated by Dimitar 8 years, 9 months ago.
-
Author
-
Hi All,
I am trying to use the font-awesome fonts for Edit and Delete buttons on my grid.
I have set up the buttons as so:
columns: [ { text: 'Edit', datafield: 'Edit', columntype: 'button', width: 32, cellsrenderer: function() { return "<div class='faEditIcon'></div>"; }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; var offset = $("#jqxgridEventTypes").offset(); $("#popupWindowEventType").jqxWindow({ position: { x: parseInt(offset.left) + 60, y: parseInt(offset.top) + 60 } }); // get the clicked row's data and initialize the input fields. var dataRecord = $("#jqxgridEventTypes").jqxGrid('getrowdata', editrow); $("#EventTypeId").val(dataRecord.EventTypeId); $("#EvtCode").val(dataRecord.Code); $("#EvtLeagueId").val(dataRecord.Name); $("#EvtDescription").val(dataRecord.Description); $("#EvtIsScore").val(dataRecord.IsScore); $("#EvtValue").val(dataRecord.Value); $("#EvtRequiresPlayer").val(dataRecord.RequiresPlayer); // show the popup window. $("#popupWindowEventType").jqxWindow('open'); } }, { text: 'Id', datafield: 'EventTypeId', width: 50 , rendered: tooltiprenderer},
It almost works, as the font is rendered using this style:
.faEditIcon { position:relative; } .faEditIcon:before { font-family: FontAwesome; font-size: x-large; margin: 0 auto; content: "\f044"; }
The problem is that the html generated has an extra span created by the grid, with an offset that means the font-awesome icon does not appear, but is off to the right.
It looks like this in the browser:
<span style="position: absolute; <strong>left: 13px; top: 12px;</strong>"> <div class="faEditIcon"></div> </span>
Any ideas what I can do to fix this?
Cheers
BrianHi Brian,
You can try increasing the row height with the rowsheight property and maybe the icon will become entirely visible. You can also try modifying the style applied to the class faEditIcon.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi,
Thanks for your help, unfortunately when I make the row height and column width larger, the problem is the button does not sit in the middle, but instead at the bottom right. This doesn’t look good. Unfortunately, no matter what css I use in the faEditIcon, I can not reverse the effects of the Span class. Do you have ny other solutions I could try?
Cheers
BrianOn another note, what is the span class in there for? It seems to serve no purpose???
Hi Brian,
As an alternative approach, you can try using a widget column instead of
columntype: 'button'
. An example can be found here: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/customwidgetscolumn.htm?light.Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.