How to use the API $.fn.dataTable.render.ellipsis with a hyperlink

How to use the API $.fn.dataTable.render.ellipsis with a hyperlink

cj1005cj1005 Posts: 142Questions: 45Answers: 1

Hi,

On my backend server, I'm doing the following code to prepare my DT, both of the below options work, but I would like to use the ellipsis function in the first option instead of showing the full data. Is this possible, please?

IF !EMPTY(urllink)
  cRender = [, render: function(data, type, row, meta) { return ( '<a href="]+atr(urllink)+[?key='+data+'" target="_blank">'+data+'</a>' ) }] 
ELSE
  cRender = [, render: $.fn.dataTable.render.ellipsis(20, true) ]
ENDIF

Something, like this:

IF !EMPTY(urllink)
  cRender = [, render: function(data, type, row, meta) { return ( '<a href="]+atr(urllink)+[?key='+data+'" target="_blank">'+ $.fn.dataTable.render.ellipsis(20, true) +'</a>' ) }] 
ELSE
  cRender = [, render: $.fn.dataTable.render.ellipsis(20, true) ]
ENDIF

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,146Questions: 1Answers: 2,586
    Answer ✓

    The Ellipsis renderer wouldn't support being used like that. You could hand-craft it by looking at the fifth example on columns.render,

    Colin

  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    Thank you!

This discussion has been closed.