GXT 3 Can't fill Grid -
i want load data remote server in grid. following code:
final repserviceasync service = gwt.create(repservice.class); final repproperties props = gwt.create(repproperties.class); rpcproxy<pagingloadconfig, pagingloadresult<reportslist>> proxy = new rpcproxy<pagingloadconfig, pagingloadresult<reportslist>>() { @suppresswarnings("unchecked") @override public void load(pagingloadconfig loadconfig, asynccallback callback) { service.getreports(callback); } }; liststore<reportslist> store = new liststore<reportslist>(props.key()); final pagingloader<pagingloadconfig, pagingloadresult<reportslist>> loader = new pagingloader<pagingloadconfig, pagingloadresult<reportslist>>( proxy); loader.setremotesort(true); loader.addloadhandler(new loadresultliststorebinding<pagingloadconfig, reportslist, pagingloadresult<reportslist>>( store)); final pagingtoolbar toolbar = new pagingtoolbar(50); toolbar.getelement().getstyle().setproperty("borderbottom", "none"); toolbar.bind(loader); columnconfig<reportslist, string> namecol = new columnconfig<reportslist, string>( props.name(), 150, "name"); columnconfig<reportslist, string> pathcol = new columnconfig<reportslist, string>( props.path_name(), 150, "path"); list<columnconfig<reportslist, ?>> l = new arraylist<columnconfig<reportslist, ?>>(); l.add(namecol); l.add(pathcol); columnmodel<reportslist> cm = new columnmodel<reportslist>(l); grid<reportslist> grid = new grid<reportslist>(store, cm) { @override protected void onafterfirstattach() { super.onafterfirstattach(); scheduler.get().scheduledeferred(new scheduledcommand() { @override public void execute() { loader.load(); } }); } }; grid.getview().setforcefit(true); grid.setloadmask(true); grid.setloader(loader);
repproperties:
public interface repproperties extends propertyaccess<reportslist> { @path("id") modelkeyprovider<reportslist> key(); valueprovider<reportslist, string> name(); valueprovider<reportslist, string> path_name(); }
reportslist code:
public class reportslist implements serializable { private static final long serialversionuid = 1l; int id; string name; string path_name; public reportslist() { } public reportslist(int id, string name, string path_name) { super(); this.id = id; this.name = name; this.path_name = path_name; } public int getid() { return id; } public void setid(int id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } public string getpath_name() { return path_name; } public void setpath_name(string path_name) { this.path_name = path_name; } }
gwt servlet impl:
public class repserviceimpl extends remoteserviceservlet implements repservice { private static final long serialversionuid = 1l; @ejb private reportejb repmanager; @override public list<report> getreports() { list<report> reports = null; reports = repmanager.getreports(); return reports ; } }
the code executed without error, query database performed ( ejb-call ), grid not populated. in problem?
in experience means there exception while trying put data grid itself. try attaching loadexceptionhandler loader , see gives you
e.g.
public class debugloadhandler implements loadexceptionihandler<listloadconfig> { @override public void onloadexception(loadexceptionevent<listloadconfig> event) { window.alert("load exception" + event.getexception().getmessage()); } }
Comments
Post a Comment