What are you trying to do on the show event of the DataGrid and/or Canvas? Are you making another remote call? Or something else?
How are you showing and/or hiding the DataGrid?
I get the data from a MySql DataBase.
See the following image, I want to refresh the dataGrid everytime is shown. If you click over the row, the state is changed and you ger more information about the row (changing the current state). I want to refresh the dataGrid if you come back from this state, or if you click on the link button, or if you click in the tabNavigator and the dataGrid is shown (The idea is sample: refresh the dataGrid everytime that is shown).
I tried with addToStage... but it only works when you change the state, if i go to "Contacto" Tab and i come back, it doesn't refresh the dataGrid.
I get the data from a MySql DataBase
From your original request it was not clear how you were updating the data.
How? When? What is your code? Are you calling a remoteObject? If so, in what event?
It looks like you're using a tabNaviator is that correct? You should be able to perform the new remote service call in an event listener for the change event of the tabNavigator.
If your data provider is ArrayCollection, try to refresh it e.g. arraycollection.refresh()
1 person found this helpful
Add a change event for your TabNavigator and send a remote call every time you change the tab from another tab into the tab which you have datagrid.
I mean track the change event and check if the current selected index of the TabNavgator is equal to the index in which your DataGrid is present then send a remote call to your Server to refresh or get the fresh data.
I call a Java method by a remoteObject, then I get the information from mySql.
The problem I have is that every time you click on a row of the dataGrid the state change and the dataGrid is hidden, then you get more information about the selected row.
The solutions you proposed are good, but partial solutions. Because if the dataGrid is hidden (because we're not in the state where the dataGrid is shown) it shouldn't be refresh when you go to another tab (from the tabNavigator) and you come back to this tab.
I have an idea of a good solution:
Combine show event, with enterState event, and make a call over a function whose first step will be to check the state of the tab.
something like this:
Put the following properties on the container where the dataGrid is: (In this case: VBox)
and then and the following function:
public function showList():void
if (currentState == '')
if (listsViewStack.selectedChild.id == allBills.id)
getBills(); //it refreshes the dataGrid
getPayedBills(); //it refreshes the other dataGrid
What do you think about this solution???
Thank you all!!!