My users have decided they want to see an icon/graphic in the column header of one of the columns on one of our iggrids. Using the headerText definition below, the icon shows in the column header on the original load of the application when the grid is set up the first time, but anytime the data is reloaded from the SQL back-end the icon disappears. Is this a feature that is just not supported, or am I going about it wrong? Thanks!
{ headerText: '<span class="glyphicon glyphicon-paperclip"></span>', key: "tmpBuildAttachIcon", dataType: "string", width: "25x" },
Hello Shashidhar,
I have been looking into your question and what I can say is that it is possible to use CSS class rules to achieve the same result.
For example:
.custom_class { width: 32px; height: 32px; background-image: url(layout_header.png); }
$("#grid").igGrid({ … columns: [ { headerText: "<div class='custom_class'></div>", key: "ProductID", dataType: "number", width: "15%", }, … ] });
Please test it on your side and let me know if you need any further information on the matter.
Sincerely, Riva Ivanova Software Developer
can we do this via css style.Img_HighRisk { background-image: url("../../Images/Grid_Icons/HighRiskOn.gif"); background-repeat: no-repeat; background-position: center;}
Thanks for the response!
Using a <div> instead of a <span> tag did not resolve the problem for me- I was still witnessing the same behavior as I was before.
At this point, the users have decided they don't want this after all, so we don't need to pursue further at this point regardless. Thank you!
Hello Becky,
Thank you for posting in our community.
Please keep in mind that by design igGrid does not support header templates out of the box.
I tried reproducing your scenario on my side using div element instead of the span(which is inline element) and everything was working as expected. The image in the header was still present after I changed the grid`s data source and called dataBind method afterwards.
I am attaching a small sample illustrating my suggestion for your reference. Please test my suggestion on your side and let mw know what is the result. Uf thisis not an accurate demonstration of what you are trying to achieve please feel free to modify my sample in order to reproduce the issue and send it back to me along with steps to reproduce.
I hope you will find my information helpful.
Please let me know if you need any further assistance with this matter.