Hi Andrea,

ULC provides built-in support for lazy loading of table rows from server
to client. ULC uploads to the client only those rows from the model that
are visible on the client. As the user scrolls down the table and as more
rows become visible, those rows are uploaded on demand. Once uploaded, the
rows remain in the client side cache.

However, you have to implement your own mechanism to populate the server
side model from the database in a lazy manner.

In ULC, you have the ULCPollingTimer to perform asynchronous tasks. You
can use ULCPollingTimer to asynchronously fetch chunks of data into your
model every time the timer fires. But note that you cannot access ULC
objects from another external thread. So you have to use an external
thread in combination with ULCPollingTimer to fetch data in background. In
an external thread, you can fetch data from a data source into a common
data structure. You can then use polling timer to access this data
structure at regular intervals
to update the table model.

Another way is to synchronize data fetching with client side upload of
data. But this could slow down your client side display of data.

One option : Implement paging in the getValueAt method of your model. This
method is called when the client requests visible rows from the server
side model. In this method you can check if the given row is present in
the model data or not and if not fetch the page containing the row from
the data source.

Second option: Everytime the ULC client requests data from the server it
calls the requestData method of the ULCTableModelAdapter. You can have
your custom ULCTableModelAadapter and override its requestData method as
follows:

protected void requestData(int[] range, int[] columns) {
     super.requestData(range, columns);
     // Code for fetching data from database into table model.  
}

PS: For faster response to your queries please consider buying to ULC
Premium Support.

Thanks and regards,

Janak

-----------------------------------------
Janak Mulani

email: [email protected]
url: http://www.canoo.com

Beyond AJAX - Java Rich Internet Applications 

http://www.canoo.com/ulc
-----------------------------------------  

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Andrea Cattani
> Sent: Thursday, January 22, 2009 2:09 PM
> To: [email protected]
> Subject: [ULC-developer] Server side Table data paging
> 
> Hello,
> 
> we have to implement a server-side paging mechanism for our
> application's tables, I've just found in the documentation 
> that this is
> a good practice, but there's no hint about how to implement that. 
> I'd like to keep client lazy loading of data and to find a way to
> populate the underlying server data in a paged way, without 
> adding next
> or prev page in the form but reusing the actual mechanism. the problem
> is that I don't find how to interact with the lazy loading 
> mechanism and
> documentation doesn't help, may you please help me ?
> 
> Thank You in advance
> 
> 
> _______________________________________________
> ULC-developer mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/ulc-developer
> 
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to