AfterInsertRow, setCell. programmatically change cell contents

I am new to JqGrid, so please bear with me. I'm having problems with cell styles when I use the showlink formatter. In my configuration, I configured AfterInsertRow, and it works fine if I just show plain 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 very well, but as soon as I add the formatter

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

the above code does not work because a new element is added to the cell

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

Is it possible to programmatically access a new child using something like the code above and change the style?

 `<a href='url.aspx' style='color: red;'>cellValue</a>` etc. 

UPDATE: to work you need to do the following:

 jQuery('#list').setCell(rowid, 'Doc_Number', '', 'redLink'); 

CSS class

 .redLink a { color: red; } 
+6
jqgrid
source share
1 answer

You can add a class to the cell:

 jQuery('#list').setCell(rowid, 'Doc_Number', '', 'redLink'); 

Then define the CSS class in these lines:

 .redLink a { color: red; } 
+6
source share

All Articles