开发者

Flex Datagrid Sort

The default behavior of th开发者_JAVA百科e Flex datagrid descending sort is that a selected row remains in view, meaning that the view will scroll down to show the selected row. I would like to change this so that when doing a descending sort the veiw remains at the top, with the selected row staying in the same position with a different row. I have tried different variations with this code but cant' get it to work:

var index:int = new int(myDG.selectedIndex);
var vertPos:int = myDG.grid.verticalScrollPosition;

myDG.selectedIndex = index; 
myDG.grid.verticalScrollPosition = vertPos;

Thanks for your help. I am just beginning with Flex.


What you could try is the following:

Lets define newIndex as the desired index you want your datagrid to navigate to.

You could try something like this:

dgInstance.scrollToIndex(newIndex);
dgInstance.selectedIndex  = newIndex;

The thing is that I didn't test the code so it might be necessary to add a:

dgInstance.validateNow(); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜