Hiding all rows except the last one

I am loading data from MySQL database which is large in volume and takes long time to load. So I decide to use two seperate handsontable - one for entering data and other for viewing (load only specific data by ajax call).

In the entry table I only fetch the last entered data by using MySQL query like below:
SELECT * FROM cars ORDER BY id DESC LIMIT 1

But the problem is in handsontable it shows all previous ids with blank rows, so I want to hide all the rows except the last one.

I tries hiddenRows and trimRows, but in both of them I have to mention the row numbers. Is there any way to achieve my goal?

I’m not sure if it will help but if you would like to show only a last row maybe you could slice it from the table and load with ‘laodData’ method, like here: http://jsfiddle.net/s1rju9bm/

Sorry! But this method is not very helpful for my purpose. It does load the single row, but it loads the first one insted of the last entry. And when try to add the new data it edited the second row except adding a new row at the end. Anyway thanks for the reply. May be I have to find some another way.

Hi @dassoubarna
I guess I misunderstood the request.
In this demo we have 10 rows and after a button click only the last rows (with values A10, B10, … J10) are left.

Do you mean the oldest row (for a dataset)? If so you just change it to: http://jsfiddle.net/9msxptc2/
[...] .slice(0, 1)

ps. if you have already found a way to achieve your goal please feel free to share you solution

It’s perfect.

Great! Glad I could help.
I guess that we can close this issue.