PDA

View Full Version : able to reload grid in IE but not FF



khanh3m
3 Nov 2006, 12:36 AM
I'm able to reload the grid to get the new data in IE 6 and up but not in FF. I see the XMLHTTPRequest go through FF and see the XML response...but it not updating the grid. First, I suspected that it a cache issue but after I add an extra parameter to the datamodel.load(url, 'foo=bar') function, I still can't get it to update. Please help!!!

jack.slocum
3 Nov 2006, 1:22 AM
How can help when you provide nothing to help with? The grid loads fine in FireFox, so there has to be an issue somewhere in the code... if you post your code or better yet a link, I would be happy to help you find the issue.

khanh3m
3 Nov 2006, 1:35 AM
Thanks for your quick reply...here is the code which create the grid and also update the grid when the user click on a specific link (i.e A, B, C) to go to specific grid for A, B, or C entries



var loadbuygroup = {init:function (dlgstartkey) {
var schema = {tagName:"viewentry", id:"unid",
subtagName: "entrydata",
fields:["text"]};
var myColumns = [{header:"Buy Group", width:400, sortable:true}];
buygroupdatamodel= new YAHOO.ext.grid.XMLDataModel(schema);
buygroupdatamodel.onLoad.subscribe(this.onLoad.createDelegate(this));

var colModel = new YAHOO.ext.grid.DefaultColumnModel(myColumns);

buygroupdatamodel.loadData = function (doc, callback, keepExisting, insertIndex) {
....override loadData....this code work fine right here
};
var param1 = "OrgList?ReadViewEntries&StartKey=" + dlgstartkey;
buygroupdatamodel.load(param1, 'foo=bar');
buygroupgrid = new YAHOO.ext.grid.Grid("dlg-load-buygroup", buygroupdatamodel, colModel);
buygroupgrid.render();
}, onLoad:function () {
buygroupgrid.getSelectionModel().selectFirstRow();
}};

khanh3m
3 Nov 2006, 1:47 AM
If I press F5 all the data display correctly on FF. Do you think this is a caching issue? I can't see you the link right now because I'm on a private network, I will try to setup a sample page and push out to my public site for you to take a look at. Thanks

KN

jack.slocum
3 Nov 2006, 1:48 AM
I can't see anything that looks bad. Where's the code that loads the new data when the user clicks a letter? This looks like the actual creation code.

Also:

var param1 = "OrgList?ReadViewEntries&StartKey=" + dlgstartkey;
buygroupdatamodel.load(param1, 'foo=bar');

You have query string parameters and post data. You can do this:

buygroupdatamodel.load('OrgList', "ReadViewEntries&StartKey=" + dlgstartkey);

rodiniz
3 Nov 2006, 3:37 AM
I have the same problem here..
http://www.rodrigodiniz.qsh.eu/QueryAnaliser.aspx

khanh3m
3 Nov 2006, 9:24 AM
The code that doing the actual data creation is :


var param1 = "OrgList?ReadViewEntries&StartKey=" + dlgstartkey;
buygroupdatamodel.load(param1, 'foo=bar');

In IE...it update the grid but when I look at it closer, the actual XMLDataModel is not update. I know this because if the grid is updated with less number of rows than previous, and when you select a row, it will give you a run time errors right at the following code in yui-ext class

YAHOO.ext.grid.XMLDataModel.prototype.getRowId = function (rowIndex) {
return this.data[rowIndex].id;
};

jack.slocum
3 Nov 2006, 12:26 PM
I'm still lost... so you are recreating the grid each time they click a letter?

rodiniz
6 Nov 2006, 2:12 AM
Hi jack...I think my sample is easier to understand.
It recreates the grid for every query you build..works like a charm in IE.
But Firefox has some weird behavior.

jack.slocum
6 Nov 2006, 4:24 AM
Recreating the grid will be a big problem if you render to the same element because the grid is bound to that element via events. To reload the data all you have to call load() how can anything be easier than that? :)

rodiniz
6 Nov 2006, 4:50 AM
The grid will have different columns depending on the query the user makes, so its not a case of justa reloading the data . My first try to solve this problem was simple:


//create new data model
grid.dataModel= dm;
grid.columnModel=cm;
//load the data
grid.render();

But that just had a result the same grid always...

jack.slocum
6 Nov 2006, 5:19 AM
Ah, I see what you are saying. Just make sure you render the new grid into a new container element and remove the old container element. This way you don't have stale event handlers firing for the old grid.

rodiniz
7 Nov 2006, 1:48 AM
The workaround its now on my sample...it seems too solve the problem.
Thanks.