PDA

View Full Version : about pagination


mohan
08-01-2003, 02:57 AM
hai antun,
in my application, i am going get large number of records from database but i want to display only 10 records at a time .So how can i do that using laszlo?
is there any particular tag or attribute for pagination?

with regards
mohan

antun
08-01-2003, 07:46 AM
You can use data replication. See the data tutorial for more info:

http://www.laszlosystems.com/developers/learn/documentation/tutorials/data.php

For example, say your data had several rows of items:


<myData>
<item />
<item />
....
<item />
<item />
</myData>


... and you wanted to show 5 per page. You might set the datapath of the view you wanted to replicate to items [1-5] initially, then items [6-10] for page 2, and items [11-15] for page three and so forth.

You would set the datapath using syntax like:


repl.setDatapath( 'myDS:/myData[1]/item[2-10]' );
repl.setDatapath( 'myDS:/myData[1]/item[6-15]' );


-Antun

k-billy
08-07-2003, 05:34 AM
Hi,

I have been dealing with the same problem, and I am also using the pagination approach (i.e. using an xpath query that contains the nodes I want to include...[1-6]).

However, one thing I have found is that re-setting the datapath requires all of the views to be redrawn. In some cases this can be quite resource intensive.

Is it not possible to move the datapointer
to the next set of sibling nodes? That is, leave the existing views alone (don't redraw them), and simply adjust the datapointer/s forward or backward?

Caleb

antun
08-07-2003, 06:53 AM
Do you have pooling turned on for the replication manager?


<view datapath="mydataset:/mydatapath....."
pooling="true" />


-Antun


However, one thing I have found is that re-setting the datapath requires all of the views to be redrawn. In some cases this can be quite resource intensive.

k-billy
08-07-2003, 01:09 PM
I have tried to modify the pooling attribute, but I always get the following error upon compilation:

"attribute "pooling" not allowed at this point; ignored"

My hope was to use the replicationManager's selectNext() method to move all of the pointers. Is this possible?

antun
08-07-2003, 01:12 PM
Can you post the code you're using that gives you the compilation warning?

-Antun

k-billy
08-07-2003, 01:31 PM
Sure. Basically, the code is for a list box component we have created. The component is called RDListbox. The view that gets replicated is called 'datarow', and it used to display each row of data in a list.

n.b. it contains some code for the previously discussed method of resetting the datapath of the replicated object.

k-billy
08-07-2003, 01:32 PM
I am also attaching a seperate file that illustrates how the RDListbox is set up in a canvas.

antun
08-07-2003, 02:02 PM
My bad!

I started debugging this, and it jogged my memory; I've been through this before:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=254&highlight=pooling

You have to use the more verbose <datapath> syntax if you want to use pooling.

-Antun

metasarah
08-08-2003, 11:10 AM
Thanks for posting your listbox. When I downloaded and ran it I got this error:

Error: rdlistbox.lzx: file not found: rdScrollingView.lzx ; compilation aborted

I don't see that file in this thread. Did I miss something?

k-billy
08-08-2003, 11:20 AM
Yes. It imports another file called a scrollingView. These are simple arrows that when clicked, move the paginated view forward/backward. Its part of my companies source code, but you could easily replace the RDScroller class in the code with your own view.

n.b. I had posted the code to assist Antun in resolving a problem that I was experiencing. It really wasn't meant to be a working example, but feel free to use what's there if it is of assitance.

antun
08-08-2003, 11:22 AM
Did you get the pooling to work using the <datapath> tag then?

-Antun

k-billy
08-08-2003, 11:45 AM
Yes. It made a significant improvement in the performance. Thanks!