Potentially a major bug with filters

Tags: #<Tag:0x00007efc72811e68>

So, handsontable provides different methods to getdata at row. I have observed a critical issue which should be rectified asap! Please let me know if this is the expected behavior. If it is please let me know what can be the alternative.

So basically, after filtering of rows, if I want to get source data at the selected row, I get the wrong value! But if I get data at row, it works fine.

Here’s the fiddle:
http://jsfiddle.net/1ouw3v2r/1/

Try to filter down on column B on value “et”.

You will see the console log of:
console.log(hot.getDataAtRow(1));
console.log(hot.getSourceDataAtRow(1));

Which should be same but they are not!

In this particular case, I can use getDataAtRow instead but my actualy data source is a json and my whole code access values using getDataAtRow(1).column1, etc.

Can you provide any alternative to this without me having to change the whole code! And also is this the correct behavior of getSourceDataAtRow?

Thanks

any update here, please?

Hi @j2275944

the results you are getting are expected. Please find the explanation below.

Before filtering

After filtering

RESULTS

  1. console.log(hot.getDataAtRow(1));

Returns a single row of the data. The row argument is the visible index of the row.

The method return data using visual index.

Result: ["orci", "et", "dignissim", "hendrerit", "12/1/2016", 8.5]

  1. console.log(hot.getSourceDataAtRow(1));

Returns a single row of the data (array or object, depending on what you have). row is the index of the row in the data source.

The method return data using logical index. Sorting and filtering are using visual incides so if you call the source methods getSourceDataAtRow / getSourceDataAtCol / getSourceDataAtCell / getSourceDataArray / getSourceData you will get a result of the source data at a current index.

Result: ["adipiscing", "elit", "Ut", "imperdiet", "5/12/2015", 6]

ok, I get your point but is there an API to get the “getDataAtRow” in an object form rather than an array. I have already used object keys everywhere in my code and it would be a real pain to replace it.

basically I want to use getDataAtRow(1).columnName1 rather than getDataAtRow(1)[0].

Thanks for clarifying.

Hi @j2275944

Let me know if that demo is OK http://jsfiddle.net/handsoncode/r7roepu3/ if not I’ll create a demo using filters

thank you this would do it. I just wanted to make sure if there is some other in built API for this.

thanks a lot again

You’re welcome.

Feel free to open a new ticket if needed.