Hello
I am new here and would help me
I have a code gwt-ext
and must add a scroll in gridPanel
so that I am not able
I code and the following
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.Intec.client.view;
import br.com.Intec.client.*;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.gwtext.client.data.*;
import com.google.gwt.core.client.GWT;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.ToolbarButton;
import com.gwtext.client.widgets.grid.*;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import java.util.ArrayList;
/**
*
* @author MICHEL
*/
public class GradeSell extends Panel{
ArrayList<Departamento> listaDepartamento = new
ArrayList<Departamento>();
private RecordDef recordDef;
private ColumnModel columnModel;
private ArrayReader reader;
private GridPanel grid;
public GradeSell() {
getService().getGrade(callback);
recordDef = new RecordDef(
new FieldDef[]{
new StringFieldDef("Nome"),
new StringFieldDef("Descricao")
}
);
grid = new GridPanel();
MemoryProxy proxy = new MemoryProxy(new Object[0][0]);
reader = new ArrayReader(recordDef);
Store store = new Store(proxy, reader);
store.load();
grid.setStore(store);
ColumnConfig[] columns = new ColumnConfig[]{
new ColumnConfig("Nome", "Nome", 400, true,
null,"Nome"),
new ColumnConfig("Descrição", "Descricao", 400, true,
null, "Descricao" )
};
columnModel = new ColumnModel(columns);
grid.setColumnModel(columnModel);
grid.setFrame(true);
grid.setStripeRows(true);
grid.setAutoExpandColumn("Nome");
grid.setAutoExpandColumn("Descricao");
grid.setAutoHeight(true);
GridView view = new GridView();
grid.setView(view);
grid.setBorder(false);
grid.setAutoScroll(true);
grid.setHeight(300);
Toolbar bottomToolbar = new Toolbar();
bottomToolbar.addFill();
bottomToolbar.addButton(new ToolbarButton("Clear Sort", new
ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
grid.clearSortState(true);
}
}));
grid.setBottomToolbar(bottomToolbar);
setGrade(listaDepartamento);
add(grid);
}
public void setGrade(ArrayList listaDepartamento)
{
getCompanyData(listaDepartamento);
}
String msg;
private void getCompanyData(ArrayList listaDepartamento) {
Object[][] data = new Object[listaDepartamento.size()][2];
for (int i = 0; i < listaDepartamento.size(); i++) {
Departamento dep = (Departamento) listaDepartamento.get
(i);
data [i][0]= dep.getNome();
data [i][1]= dep.getDescricao();
}
MemoryProxy proxy = new MemoryProxy(data);
Store store = new Store(proxy, reader);
store.load();
grid.getStore().removeAll();
grid.getStore().add(store.getRecords());
}
final AsyncCallback callback = new AsyncCallback() {
public void onSuccess(Object result) {
setGrade((ArrayList) result);
}
public void onFailure(Throwable caught) {
}
};
public static GWTServiceAsync getService() {
GWTServiceAsync service = (GWTServiceAsync) GWT.create
(GWTService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = GWT.getModuleBaseURL() +
"gwtservice";
endpoint.setServiceEntryPoint(moduleRelativeURL);
return service;
}
}
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---