Hi,
I want to create a column in datagridview with a button on the right most part of the cell, pls see attached picture, how can I do it in WiseJ?
Thanks.
Hi Glenn,
you can set the AlowHtml Property for the column to true and add HTML to your cell to show an image. I used the CellFormatting event to add the HTML to my cells.
Snippet
htmlReturn = "<div role='"+ ROLE_CELLBUTTONCLICK + "' class='my-menu-cell' style='background-image:url(\"" + base64 + "\");'>" + "</div>"; htmlReturn = newText + htmlReturn;
In CellClick event of the grid I checked for the e.Role property and send a click to my application
Snippet
if (e.Role == ROLE_CELLBUTTONCLICK) { //do something }
With this approach you handel this feature serverside. It gives you more flexiblity on changing images for each cell. But it increases server work. To get the unchanged text after a cell value was change on client you must remove the HTML Tags first.
A client side way is shown in attached example. Here all the stuff is done on client in a custom CellRenderer.
Hope this helps.
Best,
Jens
Please login first to submit.