I picked up GridDataBoundAddSample.java in the SmartGWT Showcase,
and created a small app. It add 1 recode to grid per 1 button click.
The grid initialized over 200 records.
I modified code to add 2000 records per 1 click.
The result, Firefox3 6sec, GoogleCrhome1 5sec.
Oh, Excellent ! (Q9450 3GB WindowsXpSP3)
The grid source world.data.xml contains over 200 records(country) .
I edit this xml, almost threw away, and left only 3 records.
I tried agein.
The grid initialized only 3 records.
And click,…
Firefox3 120sec, GoogleChrome1 105sec.
20 times over? What happen ? I added same 2000 records.
It be only me?
public void onModuleLoad() {
Canvas canvas = new Canvas();
final ListGrid countryGrid = new ListGrid();
countryGrid.setWidth(500);
countryGrid.setHeight(224);
countryGrid.setAlternateRecordStyles(true);
countryGrid.setEmptyCellValue("-");
countryGrid.setDataSource(WorldXmlDS.getInstance());
ListGridField countryCodeField = new ListGridField("countryCode", "Country Code");
ListGridField nameField = new ListGridField("countryName", "Country");
ListGridField capitalField = new ListGridField("capital", "Capital");
ListGridField continentField = new ListGridField("continent", "Continent");
countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);
countryGrid.setSortField(0);
countryGrid.setDataPageSize(50);
countryGrid.setAutoFetchData(true);
IButton addCountry = new IButton("Add new country");
addCountry.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
////////// UPDATE start
for(int i = 0; i < 2000; i++){
int number = getNextNumber();
ListGridRecord rec = new ListGridRecord();
rec.setAttribute("countryCode", "A" + number);
rec.setAttribute("countryName", "Country " + number);
rec.setAttribute("capital", "Capital " + number);
countryGrid.addData(rec);
}
////////// UPDATE end
}
});
addCountry.setLeft(0);
addCountry.setTop(240);
addCountry.setWidth(140);
canvas.addChild(countryGrid);
canvas.addChild(addCountry);
canvas.draw();
}