Get current row in renderer when filtering data

Tags: #<Tag:0x00007efc64cb8e20>

How can I access the source data for current row in renderer? row param returns the visualRow not the real row number (which is different if grid is filtered or sorted)

demo:

https://jsfiddle.net/kxvdo430/

column Units is concatenated from currencyCode and USD. If you filter the grid it uses data from different row :frowning:

            renderer: (instance, td, row, col, prop, value, cellProperties) => {
                td.innerHTML = instance.getSourceDataAtRow(row).currencyCode + '/USD ' + value;

                return td;
            }

Hi @dan

I’ve simplified the demo a bit but it gives the same result on filtering https://jsfiddle.net/qokd5n20/

My dataset

30

When I filter out EUR/USD

14

I get the misalignment of values.

24

What is happening here is calling the getSourceDataAtRow to share the value of a visual index of a row. Meaning, If I remove the row with index 0 (first one), next one (index 1) become visual index 0 so with your renderer it gets the value of EUR (currencyCode: ‘EUR’).

Can you tell me what you’d like to achieve in that renderer? The result of [EUR/USD EUR/USD] doesn’t seem to be an expected value in the first place.

This was just for demo. In my real situation I have a Name column and in the renderer I want to make <a href={Id column}>{Name column}

Would that https://jsfiddle.net/crux3e6a/ meet your requirements?

1 Like

yes thank you

Thank you for the update.
We can close this topic as solved.