Search code examples
bootstrap-table

How to change the clearSearch icon with bootstrap-table?


I have a table with the search clear button enabled, but I would like to change the icon from fa-trash to fa-undo. I tried below but that doesn't work.

<table id="table"
   data-icons="{ clearSearch: 'fa-undo' }"
   data-search="true"
   data-show-search-clear-button="true">

Is there an way to only change the clearSearch icon being used via the data-icons attribute? Or is there another way to do it?


Solution

  • I have overridden the clearSearch globally using:

      $.extend($.fn.bootstrapTable.defaults.icons, {
        clearSearch: 'fa-undo'
      });