When using jqGrid, the "Close" button in the caption layer utilizes icons like "ui-icon-circle-triangle-n" and "ui-icon-circle-triangle-s". If you'd like to change the "ui-icon-circle-triangle-n" icon to something else, such as "ui-icon-closethick" (refer to jQuery UI CSS Framework), follow these steps:
- To change the default icon when creating the grid:
$(".ui-jqgrid-titlebar>.ui-jqgrid-titlebar-close>span")
.removeClass("ui-icon-circle-triangle-n")
.addClass("ui-icon-closethick");
- Change the icon within the
onHeaderClick
callback after opening the grid:
onHeaderClick: function (gridstate) {
if (gridstate === "visible") {
$(this).closest(".ui-jqgrid-view")
.find(".ui-jqgrid-titlebar>.ui-jqgrid-titlebar-close>span")
.removeClass("ui-icon-circle-triangle-n")
.addClass("ui-icon-closethick");
}
}
For a demo showcasing the results, visit here: