Hi,
I'm using a Tilegrid with a DataSource to visualize images. The records fetched, and showed correctly (when I call fetchData()). However the content changes ( on the server), and I would like to update the grid periodically. I tried different ways, but couldn't find the right solution.
my datasource look like this:
The tilegrid:
I set up a timer in onModuleLoad(), like this:
What I experience:
- It seems like the tilegrid has updated (I see the loading gif), but there's no request to the server, and the images are the same. plus every time the timer runs, the DoubleClickHandler called (it sounds a bug for me)!
I quite sure that something wrong in my code, please give me some hint about how to update the Tiles of a Tilegrid periodically.
I'm using smartgwt 2.5 with chrome 15.0.874.106
Thanks
B.
I'm using a Tilegrid with a DataSource to visualize images. The records fetched, and showed correctly (when I call fetchData()). However the content changes ( on the server), and I would like to update the grid periodically. I tried different ways, but couldn't find the right solution.
my datasource look like this:
Code:
public ExperimentDataSource(String id, String folder, String strsearch ) { setID(id); setCacheAllData(true); setCacheMaxAge(2); setDataFormat(DSDataFormat.XML); setRecordXPath("/contents/item"); DataSourceField NodeName = new DataSourceField("name", FieldType.TEXT, "Name"); DataSourceField NodeType = new DataSourceField("type", FieldType.TEXT, "Type"); DataSourceField NodeImg = new DataSourceField("img", FieldType.IMAGE ); NodeImg.setImageWidth(170); NodeImg.setImageHeight(170); DataSourceField NodePath = new DataSourceField("path", FieldType.TEXT, "Path"); setFields(NodeName, NodeType, NodeImg, NodePath); }
Code:
public ExperimentTileGrid( String dataSourceID, String sfolder ) { setTileWidth(200); setTileHeight(200); setOverflow(Overflow.VISIBLE); setShowEdges( false ); experimentDataSource = new ExperimentDataSource(dataSourceID, sfolder, ""); setDataSource(experimentDataSource); addRecordDoubleClickHandler(new RecordDoubleClickHandler() { // some code, sending request. }
Code:
Timer t = new Timer() { // @Override public void run() { experimentTileGrid.invalidateCache(); experimentTileGrid.fetchData(); } }; t.scheduleRepeating(3000);
- It seems like the tilegrid has updated (I see the loading gif), but there's no request to the server, and the images are the same. plus every time the timer runs, the DoubleClickHandler called (it sounds a bug for me)!
I quite sure that something wrong in my code, please give me some hint about how to update the Tiles of a Tilegrid periodically.
I'm using smartgwt 2.5 with chrome 15.0.874.106
Thanks
B.
Comment