Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
igGrid show image for a Delete button
posted

Is there a way to show an image for the delete button?

My current Code


headerText: "",
key: "Delete",
unbound: true,
template: "<button onclick='deleteStuff(${id})''>Delete</button>",
width: 10

  • 285
    Offline posted

    Hello William,

     

    Thank you for posting in our forum.

     

    A graphical “Delete” button could be created by replacing the <button> HTML tag with the <input type=’image’> tag and setting its “src” attribute to point to the corresponding image that would be used instead. It could have event handlers attached just like a regular button.

    You code might look like this after some minor modifications:

    headerText: "",
    key: "Delete",
    unbound: true,
    template: "<input type=’image’ src=’someDeleteButtonPicture.jpg’ onclick='deleteStuff(${id})' />",
    width: 10
    

     

    Alternatively the button element could be styled with a background image and its borders, margins and other CSS properties might be modified. Please note that if you remove the button text, some width and height should be explicitly set:

     

    template: " <button onclick='deleteStuff(${id})' style='background-image:url(\"someDeleteButtonPicture.jpg \");width:50px;height:40px'></button>",

     

    If you need any additional assistance, feel free to contact me.