2 Replies Latest reply on Jul 5, 2007 7:27 AM by manu_dw

    Flex AdvancedDataGrid question


      I have a question related to custom headerRenderers for the AdvancedDataGrid (and DataGrid?). I made a custom headerRenderer that contains a TextInput control. If the user changes the text in that TextInput control an event is dispatched; the grid listens to this event, sets a filter that uses the user's input when it receives the event, and finally refreshes its data provider.

      Problem: as soon as I call dataProvider.refresh() the TextInput control loses focus. Why does it lose focus and how can I prevent this?

      Kind regards,

        • 1. Re: Flex AdvancedDataGrid question
          Hi Manu,

          I have not researched this, but I think the focus shifts back to the AdvancedDataGrid.
          I think you can set focus back to it again by calling the TextInput.setFocus().

          • 2. Re: Flex AdvancedDataGrid question
            manu_dw Level 1
            Thanks for your reaction Swaroop!

            You can indeed set focus to the text input again, but:
            - When are you going to do this? If I do it right after I refresh the dataprovider, the text field will still lose focus if refreshing takes even a tiny bit of time (ie always). So, in that case I would like to receive an event once refreshing is done, and THEN set focus to the field.
            - My event is dispatched when I receive a "change" event of the text input field. Every time the user enters a character I would need to set focus back to the text field. I tried this, but I don't think this is a nice solution: the text field will sort of "flash" because it constantly loses and gets focus...

            In fact, I don't want my text field to lose focus at all... :-)