I am having trouble with creating a datagrid with sortable columns and cells with selectable text. To get the selectable cells, I extended the Label component and set selectable=true. This works fine, except when a column is sorted by clicking on the title - at that point the selected cell moves to a different position in the column and sometimes the text in it changes. This is due to Flex reusing visible item renderer objects, so the solution is to unselect text when new data is assigned. How can I do this?
I think the solution starts by overriding the "data" property setter on the custom label, and either there or later on in the rendering process to call "this.textField.setSelection(0,0)". However, this does not seem to work.
Thanks for any help.
Maybe try mx:Text. I believe it is selecteable.
I need a single line control. I'd be interested to understand the actual problem - is it a flex bug, or some intricacy of the datagrid component, ...? The textField properties selectionBeginIndex and selectionEndIndex do not react to setSelection. You may want to try it out...