Hi everyone,
In my flex project, I have 2 widgets:
widget 1 - user input searching criteria, and when click "Ok", close widget 1 and open widget 2. widget 2 - use the searching criteria from widget 1 and display the result in a datagrid (from database).
I have successfully passed the searching criteria from widget 1 to widget 2 and the datagrid can display data according to different searching criteria in widget 1. but the datagrid cannot select a row or sorting or scrolling.
In widget 2 init() function, I add this line:
ws.GetData(query);//query is from widget 1
In the function of getting data I use:
public function GetData(event:ResultEvent):void {
datagrid.dataProvider = null;
ws.GetData(query);
datagrid.dataProvider = event.result;
}
The problem is:
If I add the line of datagrid.dataProvider = null; The datagrid data will be refresh according to different searching criteria from widget 1, but the datagrid cannot be used properly (cannot select, sort, scroll).
If I remove the line of datagrid.dataProvider = null; the datagrid can be used properly. but the data in the datagrid will never be updated according to dfferent searching criteria. It means it always display the first time searching result.
How can make it work properly? Thanks in advance.
Solved! Go to Solution.
Wu Yang,
Your workflow seems a little strange... You say that you have:
ws.GetData(query);//query is from widget 1
in the init function of widget 2
then:
In the function of getting data I use:
public function GetData(event:ResultEvent):void {
datagrid.dataProvider = null;
ws.GetData(query);
datagrid.dataProvider = event.result;
}
So it looks like you are trying to get the data again in the ResultEvent?...
Wu Yang,
Your workflow seems a little strange... You say that you have:
ws.GetData(query);//query is from widget 1
in the init function of widget 2
then:
In the function of getting data I use:
public function GetData(event:ResultEvent):void {
datagrid.dataProvider = null;
ws.GetData(query);
datagrid.dataProvider = event.result;
}
So it looks like you are trying to get the data again in the ResultEvent?...
Hi Robert,
Yes there is something wrong with my code, I have managed to resolve it. Thanks a lot for the attention.