0dd_b1t
0dd_b1t

Reputation: 568

ExtJS grid - how to focus on added row?

I have a grid(gridpanel) and data in it which I read from json query. After I added new bussines object(row) - I send him in json format to server, write to DB, and reload all grid. How I can focus on currently added row(b/o) after that? I will be very cool if I return added id at the json answer and grid take it and focus on row with added id. Thx.

Upvotes: 3

Views: 4785

Answers (1)

Kenny Peng
Kenny Peng

Reputation: 1931

How is your data being added (append-mode or not?). You can do grid_panel.getView().focusRow(row) on the length of the data array in the store, which will focus on the "last" row that was inserted. Also, you could hook into the rowsinserted event of GridView, and focusRow on the lastRow parameter that's passed in there.

Upvotes: 5

Related Questions