开发者

SmartGWT RestDateSource and Paging (Large DataSet of) Dynamic Data

I have a database table for log messages and at any开发者_如何转开发 time there can be inserted new rows. I want to show them in grid and when you scroll down I want to request more rows form this table (server side) but without to be affected from new added rows. The new rows only have to be visible if I refresh the whole grid.

I'm not sure how can I request rows in a range (from, to) using JDBC. I think there is no portable (across deferent databases) SQL query to do this? (I'm using MYSQL)

I think that after reading first page of this table I have to send to the client side the Max Id from log table and after that request new rows using this Max Id as parameter in SQL (WHERE id <= MAXID) but I'm not sure how I can pass this parameter from server to client and back using RestDateSource?

Do you have any better ideas how I can make this?

P.S. I'm using LGPL SmartGWT version and using my own servlets for server side.


Here is what I would do; I imagine that you either have a growing-number ID or a timestamp for each of your rows.

Before you start querying for data, you call a webservice to query the current id (eg last line insterted is 12345).

Then you add a Criteria object to your datasource that says "rowId <= 12345". At this point, you can use the grid freely - paging, sorting, etc will work automatically as new rows will automatically be excluded.

(Or if you use a personalized datasource and not the default RESTdataSource, you basically do the same thing without using Criteria explicitly).


SmartGWT Pro and better do this automatically. Even if you don't want to use Pro, you can download the evaluation (smartclient.com/builds) and watch the server-side console, where the SQL queries are logged.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜