JqGrid - AfterInsertRow, setCell. programmatically change the content of the cell

Posted by oirfc on Stack Overflow See other posts from Stack Overflow or by oirfc
Published on 2010-04-10T00:40:10Z Indexed on 2010/04/10 1:03 UTC
Read the original article Hit count: 1109

Hello there,

I am new to JqGrid, so please bare with me. I am having some problems with styling the cells when I use a showlink formatter. In my configuration I set up the AfterInsertRow and it works fine if I just display simple text:

 afterInsertRow: function(rowid, aData) {
   if (aData.Security == `C`) {
     jQuery('#list').setCell(rowid, 'Doc_Number', '', { color: `red` });
 } else
 {
   jQuery('#list').setCell(rowid, 'Doc_Number', '', { color: `green` });
 }
}, ...

This code works just fine, but as soon as I add a formatter

{'Doc_Number, ..., 'formatter: ’showlink’, formatoptions: {baseLinkUrl: ’url.aspx’}

the above code doesn't work because a new element is added to the cell

<a href='url.aspx'>cellValue</a>

Is it possible to access programmatically the new child element using something like the code above and change the style? <a href='url.aspx' style='color: red;'>cellValue</a> etc.

Thanks in advance,

oirfc

© Stack Overflow or respective owner

Related posts about jqgrid

Related posts about conditional-formatting