:: Forum >>

Refresh grid

I am using the AW 2.0 grid with XML as the data source. I have an event that will update the data in the source XML file, but I don't know how to refresh the grid so that it shows the changes to the source XML file.

Rick Villela
Friday, October 14, 2005
obj.refresh();
Chris Bogers
Friday, October 14, 2005
I was hoping it would be that simple.
Here is a snippet of my code:
var table = new AW.XML.Table;
table.setURL(filename);
table.setColumns(['Title', 'Description']);
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(2);
obj.setHeaderText(['Category Title', 'Description']);
obj.setCellModel(table);
document.write(obj);

As a test, I manually go and change the XML file contents after I have the page displayed.
- When I do a obj.refresh(), nothing happens
- I tried doing another table.request() and obj.refresh(), no luck
- I tried obj.setCellModel(table) again to no avail
Futhermore I even noticed that the objects are sticky. Meaning that after I leave the page or do a manual refresh of the page, the objects do not read the XML file again even though the page is being reposted.
Rick Villela
Friday, October 14, 2005
I think I discovered what the issue is with this problem. When you run the examples from c:\inetpub\www\test.htm it works great, but when you run the examples through the Web Server (I am using IIS 6.0) http://www.mysite.com/test.htm, the web server caches the page and therefore AW does not read the XML file again. I tried using the no-cache META tag and the Response.Expires=0 ASP command to no avail. But, when I set Expired=0 in the IIS server, it refresh properly.

Does anybody have any better solutions?
Rick Villela
Friday, October 14, 2005
Hi, I am using a csv file as a data src.
but whenever i want to refresh wht i only do is to call
function updateTable(){
table.request();
}

It will update ur grid not the entire page thts wht u should be interested i guess.
It works fine, but there is a bug.
If you sort the grid, after that if u change the no. of rows in the src file it gives error.
Vipin
Monday, October 17, 2005
I was able to get the same results as you with Netscape and Firefox, but with IE I still have the problem where the table.request() won't re-read the xml file unless I turn off caching for the entire site.
Rick Villela
Wednesday, November 9, 2005
Rick,

Is there anyway you can append some random number or timestamp as a parameter to your filename? A simple JS script should be able to do this. This way your browser always looks at the request as new one.

For example, instead of:

table.setURL("data.xml");

Try to append the timestamp (MMDDYYYYHHMMSS)

table.setURL("data.xml?01192006034501")



Sam S.
Thursday, January 19, 2006
This should do it

var d = new Date();
table.setURL("data.xml?"+d.getTime())
Tony
Thursday, January 19, 2006
Perfect.
Sam S.
Friday, January 20, 2006

This topic is archived.


Back to support forum

Forum search