Search code examples
jqgridjqgrid-asp.netjqgrid-phpjqgrid-formatterjqgrid-inlinenav

Replace Delete Icon of jqGrid with custom Icon


I wanted to change just the delete Icon of jqGrid in actions column with my own Icon(newTrash-icon.png). I've seen that jqGrid loads Icon from one png icons file. How do I replace the default trashcan Icon with some other trashcan Icon.

I tried below code but it doesn't work.

In my gridComplete

$('.ui-icon-trash').removeClass('ui-icon-trash').addClass('ui-icon-customtrash');

In my CSS

.ui-icon-customtrash {
    background: url("~/Images/newTrash-icon.png");
    background-position: -64px -16px;

}

I want the below icon to display in place of default delete icon

newTrash-icon.png


Solution

  • I found my answer. I have replaced inline Action Icons(delete and Notes icons) using IcoMoon App (http://icomoon.io/app/). I selected different icons I needed from IcoMoon website and created a stylesheet that I downloaded and added to my application. And using the class name("idoc-icon-trash") provided by IcoMoon I added below code in my afterInsertRow event and boooom.. it worked as shown in the figure.

    $("#gridJQ .ui-icon-trash").removeClass('ui-icon ui-icon-trash').addClass('idoc-icon-trash');
    
    .idoc-icon-trash {
        font-size: 19px;
        color: #022462;
    }
    

    enter image description here