Question: In server mode, when you filter on a text input column, the text input will loose focus when the data provider is set. How can we maintain focus?

Answer: This happens because when you reset the dataprovider, we rebuild the filter row. To maintain focus, you simply need to track the column that triggered the filter, and in the result event, where you set the dataprovider, call the setFilterFocus method. Something like this:

private var filterTriggerColumn:String="";

//This event is fired when the user changes the sort, page or filter
            private function onFilterPageSortChange(event:FilterPageSortChangeEvent):void
                //here we build our custom filter object and send it to the server
                dotNetRemoteObject.getEmployees(new MyFilter(event.filter));
                //we keep track of the field that triggered the filter, to ensure we set the focus back into it

           //Function to call when server call returns.
            private function onEmployeesResult(event:ResultEvent):void
                    //if the filter was a result of user interaction, we set the focus into the field again.


Attached, is the updated version of our Server Paging example that demonstrates this. (ServerGridDotNet.mxml)

A similar issue also occurs when the ExtendedAdvancedDatagrid is used with lockedColumns. The solution is similar, that we need to track the column that caused the filter and set focus back on it when the filter complete. (FocusIssue.mxml)


ServerGridDotNet.mxml (9.31 kb)

FocusIssue.mxml (4.75 kb)