英文:
Change Bootstrap-Table Icon
问题
作为一个开始,我想要在Bootstrap-Table按钮上更改一个FontAwesome图标。例如,我想要更改如下所示的列切换图标:
我已经阅读了关于Bootstrap-Table图标的文档,通过以下链接:https://bootstrap-table.com/docs/api/table-options/#icons 。然而,似乎我不能只是用我想要的图标属性的值来替换其中一个图标。我尝试创建自己的自定义CSS来操作按钮的图标,但没有成功。我还阅读了其他关于这个问题的StackOverflow帖子,但我无法理解它们的解决方案。如果有人可以为我提供逐步更改Bootstrap-Table表中一个按钮上的FontAwesome图标的方法,那将非常有帮助。谢谢!
我尝试通过替换table-options.md
文件中的值来更改列切换图标,该文件具有以下代码。
图标
-
属性:
data-icons
-
类型:
对象
-
详情:
定义工具栏、分页和详细视图中使用的图标。
-
默认值:
{% highlight html %}
{
paginationSwitchDown: 'fa-caret-square-down',
paginationSwitchUp: 'fa-caret-square-up',
refresh: 'fa-sync',
toggleOff: 'fa-toggle-off',
toggleOn: 'fa-toggle-on',
columns: 'fa-th-list', <------------ 尝试将此值替换为 'fa-solid fa-table-columns',例如
fullscreen: 'fa-arrows-alt',
detailOpen: 'fa-plus',
detailClose: 'fa-minus'
}
{% endhighlight %} -
示例: 表格图标
不幸的是,图标没有改变。
英文:
As a start, I would like to change one of the FontAwesome icon on the button in the Bootstrap-Table. For example, I would like to change the columns toggle icon as shown below
I have read the documentation on Bootstrap-Table icons through this link: https://bootstrap-table.com/docs/api/table-options/#icons . However, it seems that I cannot just replace the value on one of the icon properties with the one I want. I tried to create my own custom CSS to manipulate the button's icon to change but to no avail. I have also read other StackOverflow posts regarding this matter, but I cannot follow or understand their solutions. It would be helpful if anyone can provide me a step by step on how to change the FontAwesome icons on one of the buttons in the Bootstrap-Table table. Thanks!
I tried to change the column toggle icon by replacing its value in the table-options.md
file that has the following code.
icons
-
Attribute:
data-icons
-
Type:
Object
-
Detail:
Defines icons used in the toolbar, pagination, and details view.
-
Default:
{% highlight html %}
{
paginationSwitchDown: 'fa-caret-square-down',
paginationSwitchUp: 'fa-caret-square-up',
refresh: 'fa-sync',
toggleOff: 'fa-toggle-off',
toggleOn: 'fa-toggle-on',
columns: 'fa-th-list', <------------ Tried to replace this value with 'fa-solid fa-table-columns', for example
fullscreen: 'fa-arrows-alt',
detailOpen: 'fa-plus',
detailClose: 'fa-minus'
}
{% endhighlight %} -
Example: Table Icons
Unfortunately, nothing changed to the icon.
答案1
得分: 1
这里有一个在Bootstrap Table文档中使用另一个图标集的示例。此示例使用ionicons。
另外,我认为文档在使用FontAwesome方面已经过时。我相信它实际上默认使用Bootstrap Icons。
英文:
There is an example of using another icon set in the Bootstrap Table docs. This example uses ionicons.
Also, I think the docs are outdated in terms of using FontAwesome. I believe it actually uses Bootstrap Icons by default.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论