Adobe Dreamweaver Forums



Last 10 THreads :         Adobe Flash 10 kills Wimpy (Last Post : midiwriter - Replies : 83 - Views : 955 )           »          Create 2nd animation in same flash file (Last Post : dabooj - Replies : 0 - Views : 1 )           »          Local host and php Solutions help... (Last Post : RJweb - Replies : 1 - Views : 6 )           »          problems linking PDFs (Last Post : Alan - Replies : 3 - Views : 4 )           »          Flash movie not working in html (Last Post : WEBDavid - Replies : 0 - Views : 1 )           »          load xml into mc symbols (Last Post : DigitalUprising - Replies : 0 - Views : 1 )           »          drop down menu over flash (Last Post : ltartisel - Replies : 2 - Views : 3 )           »          Flash-PHP Mail Form (Last Post : kglad - Replies : 3 - Views : 4 )           »          Flash Controls Not Displaying in Embedded File (Last Post : kglad - Replies : 5 - Views : 6 )           »          DW Flash Encoder (Last Post : wycn - Replies : 2 - Views : 3 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-28-2008, 10:23 AM
premadas
 
Posts: n/a
Diggs:
Default DataGrid Refreshing Problem

Hi All,

First let me explain my problem clearly.I am facing the problem with
refreshing datagrid for add,update,delete operations.
For adding task(todo app) i am using another mxml
component(PopUpwindow).when i do add,delete or update, changes are happening
in database pakka and fine.There is no error in that.Only problem is when
i add or delete or update a task, datagrid has to
get refresh with the updated or new data.Then only from ui user will know
that he added a task or deleted a task etc right.
sometimes it's refreshing fine and sometimes not.If it doesn't refresh at
all times i can think of my logic.But if it's
happening sometimes and sometimes not.

after add or delete or update am using below 5 lines of code to refresh
datagrid.

getList.send(); //sending request again to load new data using httpservice.
datagrid.dataProvider = resultList; //resultList is bindabale
ArrayCollection variable.
resultList.refresh(); //this line not all giving any changes.i think it's
not working
datagrid.validateDisplayList();
datagrid.validateNow();

Thnaks & Regards,
premadas.



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-28-2008, 12:23 PM
gallaharsha
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hi,
I do not know the exact reason as to why your logic does not work but i can
share something which is working fine with me.
Whenever you trigger an event of add or delete or update or whatever which
alters the list in the backend you send http request to get new data.
To put it simple, suppose you add a task, you send it to the backend through
http service and on receiving a result trigger update of the datagrid. Iam
posting along here sample code. I have a form which updates a refresh rate so
when i updata , a http service is sent and the result is handled by
handlePlain()


<mx:Form x="9.95" y="10" width="386.8" height="142">
<mx:FormItem label="Data Provider Name" width="296">
<mx:ComboBox id="updt_dpName" dataProvider="{dpNamesCollection}"
editable="false" enabled="true" width="190" dropdownWidth="230" toolTip="data
provider (user defined) name" prompt="Select a DataProvider"></mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Refresh Rate" direction="horizontal" width="249">
<mx:NumericStepper id="updt_refRate" maximum="100" toolTip="refresh
rate in minutes" minimum="1"/>
<mx:Label text="Minutes" width="56"/>
</mx:FormItem>
<mx:FormItem toolTip="update refresh rate">
<mx:Button label="Update" click="update()" toolTip="update refresh rate
for the data provider"/>
</mx:FormItem>
</mx:Form>





<mx:HTTPService id="UpdateService" url="{ 'http://' + systemHost.text + ':' +
port.text + '/Prefetch/PrefetchServiceSvlt' }" useProxy="false" method="POST"
resultFormat="text" result="handlePlain(event)" fault="handleFault(event)">
<mx:request xmlns="">
<action>update</action>
<updt_dpName>{updt_dpName.selectedItem}</updt_dpNa me>
<updt_refRate>{updt_refRate.value}</updt_refRate >
</mx:request>
</mx:HTTPService>

public function handlePlain(event:ResultEvent):void{


getObjectTable();

}



public function getObjectTable():void{
ObjectTableService.send();
}



<mx:HTTPService id="ObjectTableService" url="{ 'http://' + systemHost.text +
':' + port.text + '/Prefetch/PrefetchServiceSvlt' }" useProxy="false"
method="POST" resultFormat="object" result="handleobjTable(event)"
fault="handleFault(event)" >
<mx:request xmlns="">
<action>getobjTable</action>
</mx:request>
</mx:HTTPService>

Reply With Quote
  #3 (permalink)  
Old 11-28-2008, 01:43 PM
premadas
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hi GallaHarsha,
here i'm using DataGrid with three buttons.If click on
addtask button one popupwindow will open with form fileds after entering the
details in the form the user click on the button that will store in Database
using HTTPService,JSP.After sending the data to database then again i'm sending
the request to get the data from database and diplay in DataGrid but it is not
happening why?.

Thanks & Regards,
premadas.

Reply With Quote


  #4 (permalink)  
Old 11-28-2008, 02:43 PM
Masamune
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

You need to have your getList.send() call and your dataProvider assignment in
two different functions. So, call your HTTPService in one function and then
listen for the result in a different function by setting the result event. This
is because HTTPService is an asynchronous event.

Chris

Reply With Quote
  #5 (permalink)  
Old 11-29-2008, 04:56 AM
gallaharsha
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hi,
what i meant was the same as Masamune...
The code above is similar to what Masamune suggests and thats the right
approach..
So whenever a popup opens either for adding or deleting etc.handle the result
of http service where you invoke getting datagrid table again..
Hope that solves the problem

Reply With Quote
  #6 (permalink)  
Old 11-29-2008, 05:54 AM
premadas
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

hi harsha,
I'm also using the getHttpServiceObj.send() method.
After sending the data to database i'm using the above method only for getting
the data but i didn't get the data from database sometimes.

For Add i'm using the following code......
addHttpServiceObj.send(addData);
getHttpServiceObj.send();
For Delete also same
delHttpServiceObj.send(delData);
getHttpServiceObj.send();

Anything i need to use except the above lines of code.

Thanks & Regards,
Premadas.
seenuindia555@gmail.com



Reply With Quote


  #7 (permalink)  
Old 11-29-2008, 08:08 AM
gallaharsha
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

seems to be fine with your code but are you handling the result event of the
httpservice you are sending. Let me make it clear..

Initially at the start of application you have the datagrid populated by
httpservice through some mehtod invocation.
Now you want to add a task, a popup comes which invokes a http service to add
the task in the backend and in that HttpService handle the result by setting
result="someFuctionwhichgets the dataprovider associated with the data from the
backend" , this function invokes a httpservice again to get the fresh table..

Hope you got it...

Reply With Quote
  #8 (permalink)  
Old 12-01-2008, 06:43 AM
premadas
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hey Harsha,
Same thing i have done what u said in the earlier
scrap.While Adding the task it's working and refreshing the arraycollection
also but now the problem is Deleting the task.While Deleting the task,the
particular task is deleted from the database but data is not refreshing what
is the problem behind that.


Thanks & Regards,
Premdas,
seenuindia555@gmail.com


Reply With Quote
  #9 (permalink)  
Old 12-01-2008, 06:57 AM
gallaharsha
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hi,
you can do the same thing with delete also,
whenever u delete a task you delete in the database by making a httpservice
call right,,
in the result of that u give the same function which u have used to refresh
the table after adding ..
Simply put...
whenever you think there is change in the database table invoke the function
which makes http call to update the table in the ui..
hope it is clear....

Reply With Quote


  #10 (permalink)  
Old 12-01-2008, 07:15 AM
premadas
 
Posts: n/a
Diggs:
Default Re: DataGrid Refreshing Problem

Hey harsha,
the following code i'm using for deleting a task.

<mx:HTTPService id="getTodo"
url="http://dev.edinc.in:8080/poc/ToDo/GetToDo.jsp "
result="resultHandler(event)"/>

private function delTask():void
{
delTodo.cancel();
delTodo.send(delData);
getTodo.send();

deltaskname.text = "";
deltaskdate.selectedDate = new Date();
deltaskcategory.selectedIndex = -1;
deltaskpriority.selectedIndex = -1;
deltaskstatus.selectedIndex = -1;

}
Anything i need to apply here.

Thanks & Regards,
Premdas.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:45 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk