请教GXT中grid数据不显示问题

 我来答
xiangjuan314
2016-04-26 · TA获得超过3.3万个赞
知道大有可为答主
回答量:2.9万
采纳率:0%
帮助的人:2898万
展开全部
代码如下:
final Window w = new Window();
w.setCloseAction(CloseAction.HIDE);
w.setIconStyle("icon-grid");
w.setMinimizable(true);
w.setMaximizable(true);
w.setHeading("我的日志");
w.setSize(500, 400);
w.setLayout(new FitLayout());

service = (ServerUserBaseAsync) GWT.create(ServerUserBase.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
String moduleRelativeURL = GWT.getModuleBaseURL() + "dao/serveruserbase";
endpoint.setServiceEntryPoint(moduleRelativeURL);

ToolBar toolBar = new ToolBar();
TextToolItem item = new TextToolItem();
item.setText("查找");
//item.setIconStyle("icon-connect");
toolBar.add(item);

toolBar.add(new SeparatorToolItem());
w.setTopComponent(toolBar);
item = new TextToolItem();
item.setText("增加新记录");
//item.setIconStyle("icon-user-add");
toolBar.add(item);
toolBar.add(new SeparatorToolItem());
w.setTopComponent(toolBar);
item = new TextToolItem();
item.setText("删除修改记录");
//item.setIconStyle("icon-user-delete");
toolBar.add(item);
toolBar.add(new SeparatorToolItem());
w.setTopComponent(toolBar);
item = new TextToolItem();
item.setText("刷新");
item.addSelectionListener(new SelectionListener<ComponentEvent>() {

@Override
public void componentSelected(ComponentEvent ce) {
Info.display("Event", "The '刷新' tool was clicked");
loader.load();
}
});
//item.setIconStyle("icon-user-delete");
toolBar.add(item);

// proxy and reader
RpcProxy proxy = new RpcProxy() {
@Override
public void load(Object loadConfig, AsyncCallback callback) {
service.getCustomers(callback);
}
};
BeanModelReader reader = new BeanModelReader();

// loader and store
loader = new BaseListLoader(proxy, reader);
store = new ListStore<BeanModel>(loader);

loader.load();

// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("name", "Name", 200));
columns.add(new ColumnConfig("email", "Email", 100));
columns.add(new ColumnConfig("age", "Age", 50));
ColumnModel cm = new ColumnModel(columns);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
grid.setAutoExpandColumn("name");
grid.setWidth(400);
grid.setAutoHeight(true);
grid.setBorders(true);

w.add(grid);

return w;

响应的数据如下:
//OK[14,13,12,2,11,10,9,2,8,7,6,2,5,4,3,2,4,1,["java.util.ArrayList/3821976829","com.erp.client.DAO.Customer
/3346634318","a","darrell@foo.com","Darrell","b","maro@foo.com","Maro","c","alec@foo.com","Alec","d"
,"lia@foo.com","Lia"],0,5]

GXT的示例回应数据如下:
//OK[10,9,4,2,8,7,3,2,6,5,2,2,4,3,1,2,4,1,["java.util.ArrayList/3821976829","com.extjs.gxt.samples.resources
.client.model.Customer/1058640602","darrell@foo.com","Darrell","maro@foo.com","Maro","alec@foo.com","Alec"
,"lia@foo.com","Lia"],0,5]
微测检测5.10
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇... 点击进入详情页
本回答由微测检测5.10提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式