I have a mx datagrid that I am inserting new rows into.
I want to scroll to the newly added row after it has been added. So I tried:
does not work. Is there anything else to do to get it working?
well, I think it is correct. Our business rules are to always insert a new row as a first row. But when datagrid is sorted it goes into position based on the selected order. So, sometimes, the row is not visible, and scrolling to it is not happening.
Both values are 0. I am using selectedIndex to scroll to. The grid is sorted and a row gets insterted into different positions based on a sort order. But selectedIndex is always 0 because we are placing a new row on a top.
While working on a test case I want to ask this:
What is a design pattern for the following:
A new row is always added to the top when a grid is not sorted. But when it is sorted show a new row according to the selected sort and scroll to it
having new row selected.
I am thinking to address these rules doing this:
After new row is added, remove any current sort and restore it. That will place a new row in the right position. After that scroll to the new row.
Will that work?
Well, if you remove the sort, rows will shift back to original order, and the sort indicator will disappear.
It should be possible to use a custom sort function that detects the new row and ensures its sort order to be at the top.