Hello,
I am trying to make my listgrid columns based on user selection.
The listGrid's datasource is being (at the beginning) attached with DataSource.get("myDS");
When the user selects the columns to be shown, I call the method listGrid.setFields(field1, field2, ....).
It actually works, but when there are many columns (in my example 11 columns) the scrolling takes a lot of time.
When I start the "adminConsole.jsp", and I select the same datasource, it shows even more columns (16) and the scrolling is very smooth.
Whan am I doing wrong?
I am using firefox 3.6 and my js log is:
15:17:29.264:INFO:Log:initialized
15:17:29.590:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver]
15:17:30.007:WARN:Log:New Class ID: 'IAutoFitButton' collides with ID of existing Class object '[Class IAutoFitButton]'. Existing object will be replaced.
15:17:30.007:WARN:Log:New Class ID: 'HeaderImgButton' collides with ID of existing Class object '[Class HeaderImgButton]'. Existing object will be replaced.
15:17:59.480:INFO:Log:isc.Page is loaded
I am testing from within eclipse, so I am not compiling the project.
I am using SmartGWT 2.4 EE.
Thank you for your help
My code: (the relevant method is setAdditionalComponentFields(ListGridField ... fields) )
I am trying to make my listgrid columns based on user selection.
The listGrid's datasource is being (at the beginning) attached with DataSource.get("myDS");
When the user selects the columns to be shown, I call the method listGrid.setFields(field1, field2, ....).
It actually works, but when there are many columns (in my example 11 columns) the scrolling takes a lot of time.
When I start the "adminConsole.jsp", and I select the same datasource, it shows even more columns (16) and the scrolling is very smooth.
Whan am I doing wrong?
I am using firefox 3.6 and my js log is:
15:17:29.264:INFO:Log:initialized
15:17:29.590:WARN:AutoObserver:Use addInterfaceProperties() to add methods to interface [Class AutoObserver]
15:17:30.007:WARN:Log:New Class ID: 'IAutoFitButton' collides with ID of existing Class object '[Class IAutoFitButton]'. Existing object will be replaced.
15:17:30.007:WARN:Log:New Class ID: 'HeaderImgButton' collides with ID of existing Class object '[Class HeaderImgButton]'. Existing object will be replaced.
15:17:59.480:INFO:Log:isc.Page is loaded
I am testing from within eclipse, so I am not compiling the project.
I am using SmartGWT 2.4 EE.
Thank you for your help
My code: (the relevant method is setAdditionalComponentFields(ListGridField ... fields) )
Code:
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
public class SchuelerListGrid extends ListGrid {
public static final String EMPTY_FIELD = "emptyField";
public static final String EMPTY_FIELD_DISPLAY_NAME = " ";
private DataSource ds = DataSource.get("schueler");
private int attachedDataSourceFrom = -1;
private boolean attachedDataSource = false;
private ListGridField nameField;
private ListGridField vornameField;
private ListGridField gebDatumField;
public SchuelerListGrid() {
super();
setLoadingDataMessage("${loadingImage} " +Zedes2.getConstants().loadingMessage());
//setLoadingMessage(Zedes2.getConstants().loadingMessage());
setShowAllRecords(false);
setSortField(0);
setAutoFetchData(false);
setCanEdit(false);
setShowFilterEditor(true);
setFilterOnKeypress(true);
setFetchDelay(500);
setComponentFields();
setDataSource(ds);
}
private void setComponentFields() {
nameField = new ListGridField("name", "Name");
vornameField = new ListGridField("vorname", "Vorname");
gebDatumField = new ListGridField("geb_datum", "Geb. Datum");
setFields(nameField, vornameField, gebDatumField);
}
private void setSchultypCriteria(int schultyp) {
Criteria n = new Criteria();
n.setAttribute("schultyp",schultyp);
fetchData(n);
}
public void setAdditionalComponentFields(ListGridField ... fields) {
ListGridField[] f = new ListGridField[fields.length + 3]; //because of name, vorname, gebDatum
f[0] = nameField;
f[1] = vornameField;
f[2] = gebDatumField;
for (int i=3; i<= f.length-1; i++) {
f[i] = fields[i-3];
}
setFields(f);
}
public void attachDataSource(int einrichtungID) {
attachedDataSourceFrom = einrichtungID;
setSchultypCriteria(einrichtungID);
attachedDataSource = true;
}
public boolean getHasAttachedDataSourceFrom(int einrichtungID) {
return einrichtungID == attachedDataSourceFrom;
}
public boolean hasAttachedDataSource() {
return attachedDataSource;
}
public void attachDataSourceAll() {
fetchData();
attachedDataSource = true;
}
}
Comment