HiddenRows and Custom Renderer

As far as I can see, hiddenRows are also processed by custom Renderers. How can I disable that behavior
-> do not render hidden rows.

Thanks, Christof

Hi @johnny.petersen

I am not sure what you would like to achieve. You do not need to add any custom renderers to use hiddenRows plugin. Could you please share an example of unwanted behavior?

Hi Aleksandra,

I’ve build a small test: http://jsfiddle.net/ccrider/g78qj0jh/

I’d like to have the link column aligned with the other columns. Row3 -> Link to row3 …
Furthermore no rendering in spareRows. How can I achieve this?

So my question was, how to avoid rendering of cells for trimmed rows?

Thanks for your help …

Wrong link … one moment …

Please try this sample: http://jsfiddle.net/ccrider/jbv31wz6/

Thank you fir the demo @johnny.petersen

It looks like minSpareRows is a cause of the error. When we comment it the trimmed rows aren’t visible

I guess that I’d be able to find a workaround as the issue is gone when we use alter method Handsontable Basic Example (100x10) - JSFiddle - Code Playground

There’s only one question. Do you want the empty spare rows to hold the link and display it or just leave the rows blank?

So, what I’d like to have is a table with empty spare rows and the correct order in rows after applying trimRows.
Right now, the rendering also takes place for trimmed (hidden) rows
At the end the table should look like:

0, Row0, link to row0
3, Row3, link to row3
4, Row4, link to row4
null, null,null
null, null,null
null, null,null
null, null,null
null, null,null

If you consider switching from trimRows to hiddenRows I have a workaround. It would be more recalculation with trimRows as they apparently while cutting off the rows [1,2,5] gives them last indexes of the table.

So firstly I have changed trimRows to hiddenRows and used toPhysicalRow method to get the physical row index

Then we need to define that link appears only when column 0 and 1 are empty

I’ve done that by adding an IF statement to the renderer

function link_renderer(instance, td, row, col) {
  var myRows = hot.toPhysicalRow(row);

  if (hot.getDataAtCell(row, 0) !== null && hot.getDataAtCell(row, 1) !== null) {
    var linktext = "link to Row " + myRows;
    td.innerHTML = '<a href="#">' + linktext + '</a>'
  }
  return td;
}

and the last thing is to add next 5 spare rows if user adds some context to empty cells. I just finished by shift but if you’d have problems with that part of code let me know.

I started with hiddenRows until I read Limited number of hidden rows - max. 1000 in your docs

Thats why I can’t use hiddenRows :frowning:

And I tried of course the same like you in the renderer - asking for value in column 0, but as you said - that’s not working with trimRows

Or is that 1000 row limit no longer valid: I tried this and its working: http://jsfiddle.net/ccrider/xne421d7/

But no spare rows …

Hi @johnny.petersen

I’ve finished my example http://jsfiddle.net/handsoncode/udeotrk4/ you can test it with a larger dataset

Thanks, but you don’t have any hidden or trimmed Rows in your fiddle…

I took your sample, added the hiddenRows attribute and created 5000 rows. Result is the same … No spare rows

pls try http://jsfiddle.net/ccrider/nqubpywa/

Am I doing something wrong?

And what about the limitation to a 1000 hiddenRows only like described here:
https://handsontable.com/blog/articles/3-ways-to-hide-rows-in-handsontable

  • Limited number of hidden rows - max. 1000

Is that still valid or is that document outdated?

Hi Alexandra,

can you pls let me know if the 1000 row restriction is still valid?

Thanks in advance

Hi @johnny.petersen

I have asked the developer who has made the plugin and he told me that we do not validate how many rows you want to hide. The 1000 digit in the post is only there as a tip. If you want to hide more the performance can get worse.