Saturday, 15 May 2010

jqGrid change formatter of cell when cell has no value -


I have a jqGrid that has one of the columns set formatter as hyperlink

  {name: 'IDNumber', index: 'IDNumber', classes: 'hyperlink', search: correct, stype: 'text', formater: 'sholin', format options : {BaseLinkUrl: '#'}},   

When a cell is not in the IDNumber value, then I want to change the format to string.

The reason why I want to do this is when the cell has no value and does not display this gridline when it is linked as a formatter

Formatter showlink output and lt; for each input data containing strings (empty string) or number A & gt; element

I'm not perfect, make sure I understand exactly what you want.

If I understand you correctly, then you need to make the link "clickable" even if the cell contains the empty string to do this so that you have all the columns in it Empty strings can replace some things like "& amp; nbsp; & amp; nbsp;" .

Another option I can suggest is that you want to use my dynamic link format which I have described. It is very easy, but the predefined format is more powerful in the form of sholink . It shows how you can use it. Column

  {name: "mylink", width: 60, sortable: false, formatter: "dynamiclink", formatoptions: {cellValue: function cell valley , Line ID, row data, options) {return cell value! == ""? Cell Value: "& lt; span style = 'color: red' & gt; blank link & lt; / span & gt;"; }, URL: function (cell value, line ID, row data) {return / store / adapter? Id = '+ rowId +'? ' + $ .perm ({name: rowData.name}); }}}   

Allows to define the custom cell value and the URL used in the link. The source code of the formator that you can find displays the demo grid

Enter the image details here

Where I put some custom text (red text" blank link ") instead of empty string.

No comments:

Post a Comment