Pagination didn't work
hi all,
i found examples about list grid and google rpc on forum. it was clear everything.
but pagination does not work. here is my classes attached ..
i didn't know what is incorrect here
In RouterTab.java i have placed list grid.
RouterDataSource.java is my datasource class.
other is my service implementation
problem is what when i draw RouterTab all records are visible not only first 20,
which i defined by method listGrid.setDataPageSize(20); in RouterTab.java
help is urgent :(
Thanks In Advance.
____________________
Regards,
Paata Lominadze
Magticom LTD.
Announcement
Collapse
No announcement yet.
X
-
Need help with the Server Side sorting on ListGrid using GWT RPC mechanism
Hi,
Can you please post sample line of code to invoke the server side sorting in ListGrid Using GWT RPC.
How to enable the server side sorting on ListGrid?
on executeFetch, request.getSortBy() always shows null, how to set this value?
showcase example was not much of help, can somebody please post the client side sorting line of code vs server side sorting line of code
Thanks for your great support.
Leave a comment:
-
Hi, all i think that if you use smart gwt + rpc you may want to use json-rpc or just pass json strings that are converted to java objects to the server. Here is what i mean:
Code:String jsonStringCameFromServerRPC = "........"; final JSONObject obj = (JSONObject) JSONParser.parse(jsonStringCameFromServerRPC); final ListGridRecord record = new ListGridRecord(obj.getJavaScriptObject()); ds.addData(record);
And on the server:
Code:final JSON json = new JSON(); DTO someDTO ..... json.addConvertor(DTO.class, new JSONPojoConvertor(DTO.class)); String jsondto = json.toJSON(someDTO)); //send jsondto string to the grid
This is just a simple example.
I am using jetty-util.jar for JSONPojoConverter, it supports nested pojos.
Hope this helps to someone.
Leave a comment:
-
Dude, there are plenty of examples in the forum and in the showcase. You may also read this thread and download the generic rpc template for smart gwt or look for smart gwt ee/pro.
Originally posted by paatalhi all,
I'm newbie with smartgwt
can anybody post small code snippet how to add record to listgrid.
I have listgrid and bellow it is add record button
add record button opens new window for filling parameters for record.
how to add record now ?
is it correct if i create ListGridRecord class instance and fill its attributes and
call dataSource.addData(listGridRecord); ?
if yes it didn't not work i get javascript errors:
"(TypeError): null has no properties"
is it correct if new window call addNewMyObject(My obj ...) mehtod
and after success adding destroy window and fetch data again ?
what is correct design pattern ???
____________________
Rgards,
Paata Lominadze
Magticom LTD.
Leave a comment:
-
how to call add record
hi all,
I'm newbie with smartgwt
can anybody post small code snippet how to add record to listgrid.
I have listgrid and bellow it is add record button
add record button opens new window for filling parameters for record.
how to add record now ?
is it correct if i create ListGridRecord class instance and fill its attributes and
call dataSource.addData(listGridRecord); ?
if yes it didn't not work i get javascript errors:
"(TypeError): null has no properties"
is it correct if new window call addNewMyObject(My obj ...) mehtod
and after success adding destroy window and fetch data again ?
what is correct design pattern ???
____________________
Rgards,
Paata Lominadze
Magticom LTD.
Leave a comment:
-
mnenchev, I agree. This looks very interesting, but also a little confusing at first look. I would also be very interested in a small example using these interfaces too see what this is about.
Leave a comment:
-
Hi, could you give us, more detailed example? What is this DTObjectModel. Pleas provide some simple usage :).
Originally posted by lanceweberI just wanted to point out that with the nifty use of generics you can only have to implement this class once. We've got an initial implementation up and running very nicely by using a Resource interface that bridges between Models and SmartGWT constructs.
Here's a snippet, just enough to get you started thinking about it and yes, this requires the you have a pretty good handle on coding with generics.
Code:public interface HasSmartGWTResources<M extends DTObjectModel> { List<DataSourceField> getDataSourceFields(); M newModel(); ListGridRecord toListGridRecord(M model); M toModel(ListGridRecord record); DvTreeNode toTreeNode(M model, String parentid); List<DvTreeNode> toTreeNodeWithChildren(M model, String parentid); } public interface DataService<M extends DTObjectModel> extends RemoteService { List<M> fetch(int startIndex, int count); M add(M model); M update(M model); void remove(M model); } public interface DataServiceAsync<M extends DTObjectModel> { void fetch(int startIndex, int count, AsyncCallback<List<M>> async); void add(M model, AsyncCallback<M> async); void update(M model, AsyncCallback<M> async); void remove(M model, AsyncCallback<M> async); } public class SmartGWTDataSource<M extends DTObjectModel, R extends HasSmartGWTResources<M>, S extends DataService<M>> extends DataSource { private HasSmartGWTResources<M> resource; private DataServiceAsync<M> service; /** * Creates new data source which communicates with server by GWT RPC. * It is normal server side SmartClient data source with data protocol * set to <code>DSProtocol.CLIENTCUSTOM</code> ("clientCustom" - natively * supported by SmartClient but should be added to smartGWT) and with data * format <code>DSDataFormat.CUSTOM</code>. */ @SuppressWarnings("unchecked") public SmartGWTDataSource(HasSmartGWTResources<M> resource, Class<S> serviceClass) { super(); setDataProtocol (DSProtocol.CLIENTCUSTOM); setDataFormat (DSDataFormat.CUSTOM); setClientOnly (false); this.resource = resource; service = (DataServiceAsync<M>) GWT.create(serviceClass); for (DataSourceField field: resource.getDataSourceFields()) { addField(field); } GWT.log("SourcebookDataSource() initialized.", null); } . . . }
Leave a comment:
-
Hello Charles,
Thank you very much. I have already solved the problem. Sorry for not updating my post regarding that issue. First, I used setIsFolder(true) on folder nodes and setIsFolder(false) on leaf nodes. To eliminate the "plus" icon on empty nodes, I had to manually invoke setChildren() on the nodes in question, supplying an empty array of records, like so:
Code:if ( !hasChildNodes ) setChildren( new TreeNode[0] );
Leave a comment:
-
Originally posted by jballhDoes anyone have an example on how to populate a TreeGrid using the GwtRpcDataSource?
I have tried to build an array of TreeNodes in the executeFetch method and set it as return data, but the result was somehow glitchy. The leaf nodes (on the lowest level) were falsely displayed with a plus button to expand their contents, but logically they have no children. When I click the plus button, all records in the TreeGrid disappear.
You need to be careful how you setup your children nodes ie: make sure you don't reference the children attribute for the child nodes, only for the parent nodes.
But in order to work out what your issue is completely you would need to post your code.
Leave a comment:
-
Another question, does anyone have an example for the "executeRemove" method?
How is this supposed to work, I mean, how is the displayed record removed from the connected data control? By deleting data on the server and then refreshing data?
I have a read-only dataSource connected to a ListGrid and I want to remove records from this list grid. I do not need to contact the server, I just want to delete the corresponding ListGridRecord in presentation tier. How can I achieve this? ListGrid.removeData() does not seem to work, maybe because the ListGrid is connected to a DataSource. An obvious solution would be the usage of disconnected data, but unfortunately, filtering does not work for me then.
Leave a comment:
-
Does anyone have an example on how to populate a TreeGrid using the GwtRpcDataSource?
I have tried to build an array of TreeNodes in the executeFetch method and set it as return data, but the result was somehow glitchy. The leaf nodes (on the lowest level) were falsely displayed with a plus button to expand their contents, but logically they have no children. When I click the plus button, all records in the TreeGrid disappear.
Leave a comment:
-
Originally posted by lanceweberI just wanted to point out that with the nifty use of generics you can only have to implement this class once. We've got an initial implementation up and running very nicely by using a Resource interface that bridges between Models and SmartGWT constructs.
Here's a snippet, just enough to get you started thinking about it and yes, this requires the you have a pretty good handle on coding with generics.
Code:public interface HasSmartGWTResources<M extends DTObjectModel> { List<DataSourceField> getDataSourceFields(); M newModel(); ListGridRecord toListGridRecord(M model); M toModel(ListGridRecord record); DvTreeNode toTreeNode(M model, String parentid); List<DvTreeNode> toTreeNodeWithChildren(M model, String parentid); } }
These generics aren't half as scary looking as the ninja generics in GWT's source code. ;)
Leave a comment:
-
using an exception object
after reading the code further , i believe the solution might be to throw an exception on error , and put the error messages in the exception object.
in the onFailure parse them into response.data.
is that the correct approach?
Thanks,
Shay
Leave a comment:
-
showing error messages
hi all,
thank you for the great solution.
i am currently using the restDataSource and when an error occurs on a specific record update, my server returns an error msg per record.
thanks to the great way in which smart handles errors,the grid displays those messages automatically.
how do i achieve the same with the rpc data source?
thanks,
shay
Leave a comment:
-
TestAdvDataSource
i tried TestAdv one, i tried listGrid.fetchData(form.getValuesAsCriteria());
but it will show all data instead of what i defined as in the criteria..
any idea why?
Leave a comment:
Leave a comment: