Paging in xforms

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Paging in xforms

srikanth.prodigy

All,

 

I am trying to list the details in pages by using xforms:repeat-number inside xforms:repeat

 

<xforms:repeat  nodeset="if($tagval=0 ) then Event[(ExpirationDate='' or ExpirationDate &gt; current-date())] else Event[Tag/TagId=$tagval and (ExpirationDate='' or ExpirationDate &gt; current-date())]" id="event-repeat">

       

    <tr xforms:repeat-number=”1”>  

  

……

</tr>

 

But this does not work

 

How to list the entries in pages like 10 entries for each page

 

Thanks,

Srikanth A



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Paging in xforms

fl.schmitt(ops-users)
Srikanth,

> How to list the entries in pages like 10 entries for each page

there are some threads regarding that issue in the list archive:
http://www.nabble.com/forum/Search.jtp?forum=2537&local=y&query=paging

for example:
http://www.nabble.com/Re%3A-Paging-issue-p13166304.html

xforms:repeat-number was reported to be not supported in mid 2007:
http://www.nabble.com/Re%3A-RES%3A-detecting-the-current-repeat-index-p11942718.html

and as there are some workarounds to implement paging, i think it still
doesn't have high priority.


hth
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Paging in xforms

srikanth.prodigy

Hello Florian

I have implemented paging in xforms using previous, next buttons

<xforms:instance  id="page">
                <page xmlns="">0</page>
                       
          </xforms:instance>
<xforms:instance id="req">
               <req xmlns="">
                   <previous/>
                   <next/>
                   
                   </req>
               </xforms:instance>

<xforms:bind nodeset="instance('req')/previous"
readonly="xs:int(instance('page')) = 0 "/>
<xforms:bind nodeset="instance('req')/next"
readonly="(xs:int(instance('page')) = ($pages - 1))" />
----------------------------------------------------------------------------
Variable for count number of pages

<xforms:variable name="pages" select="if(xs:int($tagval)= 0) then
ceiling(count(instance('events-instance')/Event[(ExpirationDate='' or
ExpirationDate &gt; current-date())]) div 4) else ceiling(count
(instance('events-instance')/Event[Tag/TagId=$tagval and (ExpirationDate=''
or ExpirationDate &gt; current-date())]) div 4)" />


----------------------------------------------------------------------------
Previous next buttons
<xforms:trigger ref="instance('req')/previous" appearance="minimal">
        <xforms:label><xhtml:img
src="/../eventsxpl/image/previous.png"/></xforms:label>
       
        <xforms:setvalue ev:event="DOMActivate" value="instance('page')- 1"
                         ref="instance('page')"/>
                       
    </xforms:trigger >
    </td>
    <td>
    <xforms:trigger ref="instance('req')/next" appearance="minimal">
        <xforms:label><xhtml:img src="/../eventsxpl/image/next.png"/>
</xforms:label>
       
        <xforms:setvalue ev:event="DOMActivate" value="instance('page')+ 1"
                                 ref="instance('page')"/>
                                 
    </xforms:trigger>
----------------------------------------------------------------------------

Repeat condition

<xforms:repeat id="event-repeat"
nodeset="instance('events-instance')/Event[(Tag/TagId=$tagval) and
(ExpirationDate='' or ExpirationDate &gt; current-date()) and  (position()
gt number(instance('page'))* 4 and position() le
(number(instance('page')+1))* 4) ]" >
----------------------------------------------------------------------------

Issues:

1)it is displaying irrelevant number of records example: if the limit is to
display 4 records it is displaying 3 records

2)  if there are no records to display the next button is enabled

3)  The repeat condition is not filtering the records properly
   Example: in the above repeat it should display the records based on tagid
it is displaying the records but it is also showing a record(blank) which is
Not satisfied by the repeat condition(***NOTE*** when the number of records
to display is 1)

4) I have to tried to print the position() value it is displaying always 1
    But records are diplayed when the condition is failed.

Excuse me for this big mail. I need to fix this issues

Thanks
Srikanth







-----Original Message-----
From: Florian Schmitt [mailto:[hidden email]]
Sent: Wednesday, January 28, 2009 4:51 PM
To: [hidden email]
Subject: [ops-users] Re: Paging in xforms

Srikanth,

> How to list the entries in pages like 10 entries for each page

there are some threads regarding that issue in the list archive:
http://www.nabble.com/forum/Search.jtp?forum=2537&local=y&query=paging

for example:
http://www.nabble.com/Re%3A-Paging-issue-p13166304.html

xforms:repeat-number was reported to be not supported in mid 2007:
http://www.nabble.com/Re%3A-RES%3A-detecting-the-current-repeat-index-p11942
718.html

and as there are some workarounds to implement paging, i think it still
doesn't have high priority.


hth
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

upcomingevents.xhtml (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: Paging in xforms

Hank Ratzesberger

Shrikanth,

I'm sorry I probably can't help you with your code, but I
have done paging with <xf:repeat> groups, and I found it to
work great.

I use a submission to update the instance that the repeat
displays. The next and prev controls submit to that instance,
and the service returns one "page" of data.

I have a control instance with the start position and the number of
"rows" (repeat elements) to display.  And, a value for whether the
next/previous button should be enabled:

<xforms:instance id="query">
        <query xmlns="">
                <start>1</start>
                <howmany>10</howmany>
                <next>false</next> <!-- Enable/disable next and prev buttons -->
                <prev>true</prev>
        </query>
</xforms:instance>

I bind the next/prev values:

<xforms:bind nodeset="instance('query')"
        <xforms:bind nodeset="start" constraint=". &gt; 0"/>
        <xforms:bind nodeset="howmany" />
        <!-- Readonly if the start - howmany greater than the hits -->
        <xforms:bind nodeset="next"
                readonly="boolean-from-string(.)"
                calculate="(instance('query')/start + instance('query')/howmany)  
&gt; instance('events')/hits"/>
        <!-- Readonly if the start - howmany less than 1 -->
        <xforms:bind nodeset="prev"
                readonly="boolean-from-string(.)"
                calculate="(instance('query')/start - instance('query')/howmany)  
&lt; 1"/>
</xforms:bind>

I group controls for the next and prev (well, maybe group is not  
required), and
set values for the <start> element :

<xforms:group ref="instance('query')">
        <!-- The Prev button subtracts 10 from _start and redraws. -->
        <span style="float: left"><xforms:trigger ref="prev">
                <xforms:label>&lt;&lt; Prev</xforms:label>
                <xforms:action ev:event="DOMActivate">
                        <xforms:setvalue ref="instance('query')/start" value="instance
('query')/start - instance('query')/howmany"/>
                        <!-- sumbission.... -->
                </xforms:action>
        </xforms:trigger></span>

        <!-- The Next button adds 10 to _start and redraws the map -->

        <span style="float: right"><xforms:trigger ref="next">
                <xforms:label>Next &gt;&gt;</xforms:label>
                <xforms:action ev:event="DOMActivate">
                        <!-- Do set the start position and the cached query -->
                        <xforms:setvalue ref="instance('query')/start" value="instance
('query')/start + instance('query')/howmany"/>
                        <!-- submission here, it uses start and howmany -->
                </xforms:action>
        </xforms:trigger></span>

        <strong> Events <xforms:output value="start"/> to <xforms:output  
value="start + howmany - 1"/> </strong>

</xforms:group>

I don't show it, but I also do a submit that has the effect of  
updating the
instance that gets displayed in the repeat.

If that even helps...hope so.

--Hank


On Feb 6, 2009, at 12:07 AM, Srikanth A wrote:

>
> Hello Florian
>
> I have implemented paging in xforms using previous, next buttons
>
> <xforms:instance  id="page">
>                 <page xmlns="">0</page>
>
>           </xforms:instance>
> <xforms:instance id="req">
>                <req xmlns="">
>                    <previous/>
>                    <next/>
>
>                    </req>
>                </xforms:instance>
>
> <xforms:bind nodeset="instance('req')/previous"
> readonly="xs:int(instance('page')) = 0 "/>
> <xforms:bind nodeset="instance('req')/next"
> readonly="(xs:int(instance('page')) = ($pages - 1))" />
> ----------------------------------------------------------------------
> ------
> Variable for count number of pages
>
> <xforms:variable name="pages" select="if(xs:int($tagval)= 0) then
> ceiling(count(instance('events-instance')/Event[(ExpirationDate='' or
> ExpirationDate &gt; current-date())]) div 4) else ceiling(count
> (instance('events-instance')/Event[Tag/TagId=$tagval and  
> (ExpirationDate=''
> or ExpirationDate &gt; current-date())]) div 4)" />
>
>
> ----------------------------------------------------------------------
> ------
> Previous next buttons
> <xforms:trigger ref="instance('req')/previous" appearance="minimal">
>         <xforms:label><xhtml:img
> src="/../eventsxpl/image/previous.png"/></xforms:label>
>
>         <xforms:setvalue ev:event="DOMActivate" value="instance
> ('page')- 1"
>                          ref="instance('page')"/>
>
>     </xforms:trigger >
>     </td>
>     <td>
>     <xforms:trigger ref="instance('req')/next" appearance="minimal">
>         <xforms:label><xhtml:img src="/../eventsxpl/image/next.png"/>
> </xforms:label>
>
>         <xforms:setvalue ev:event="DOMActivate" value="instance
> ('page')+ 1"
>                                  ref="instance('page')"/>
>
>     </xforms:trigger>
> ----------------------------------------------------------------------
> ------
>
> Repeat condition
>
> <xforms:repeat id="event-repeat"
> nodeset="instance('events-instance')/Event[(Tag/TagId=$tagval) and
> (ExpirationDate='' or ExpirationDate &gt; current-date()) and  
> (position()
> gt number(instance('page'))* 4 and position() le
> (number(instance('page')+1))* 4) ]" >
> ----------------------------------------------------------------------
> ------
>
> Issues:
>
> 1)it is displaying irrelevant number of records example: if the  
> limit is to
> display 4 records it is displaying 3 records
>
> 2)  if there are no records to display the next button is enabled
>
> 3)  The repeat condition is not filtering the records properly
>    Example: in the above repeat it should display the records based  
> on tagid
> it is displaying the records but it is also showing a record(blank)  
> which is
> Not satisfied by the repeat condition(***NOTE*** when the number of  
> records
> to display is 1)
>
> 4) I have to tried to print the position() value it is displaying  
> always 1
>     But records are diplayed when the condition is failed.
>
> Excuse me for this big mail. I need to fix this issues
>
> Thanks
> Srikanth
>
>
>
>
>
>
>
> -----Original Message-----
> From: Florian Schmitt [mailto:[hidden email]]
> Sent: Wednesday, January 28, 2009 4:51 PM
> To: [hidden email]
> Subject: [ops-users] Re: Paging in xforms
>
> Srikanth,
>
>> How to list the entries in pages like 10 entries for each page
>
> there are some threads regarding that issue in the list archive:
> http://www.nabble.com/forum/Search.jtp?forum=2537&local=y&query=paging
>
> for example:
> http://www.nabble.com/Re%3A-Paging-issue-p13166304.html
>
> xforms:repeat-number was reported to be not supported in mid 2007:
> http://www.nabble.com/Re%3A-RES%3A-detecting-the-current-repeat- 
> index-p11942
> 718.html
>
> and as there are some workarounds to implement paging, i think it  
> still
> doesn't have high priority.
>
>
> hth
> florian
>
> <upcomingevents.xhtml>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Re: Paging in xforms

srikanth.prodigy
Hello Hank

how to use start and Howmany elements in submission I have used as mentioned
below but the instance is not filled with  data

<xforms:submission id="page-events"
resource="/portlet-welcome/geteventscollection" separator="&amp;"
replace="instance" method="get"
ref="instance('events-instance')/Events[(position() ge
instance('req')/start) and (position() lt xs:int(instance('req')/start +
instance('req')/howmany))) ]" />
-------------------------------------------------------------------------
If I used this submission I can get all the records
<xforms:submission id="page-events"
resource="/portlet-welcome/geteventscollection" separator="&amp;"
replace="instance" method="get" ref="instance('events-instance') " />
---------------------------------------------------------------------------
Can u please mention the submission which you have used in trigger to update


The instance

Thanks,
Srikanth




<xforms:trigger ref="instance('req')/previous" appearance="minimal">
        <xforms:label><xhtml:img
src="/../eventsxpl/image/previous.png"/></xforms:label>
        <xforms:action>
       
        <xforms:setvalue ev:event="DOMActivate" value="xs:int(instance
('req')/start - instance('req')/howmany)"
                         ref="instance('req')/start)"/>
            <xforms:send submission="page-events" ev:event="DOMActivate" />
            </xforms:action>
                       
    </xforms:trigger >
    <xforms:trigger ref="instance('req')/next" appearance="minimal">
        <xforms:label><xhtml:img src="/../eventsxpl/image/next.png"/>
</xforms:label>
       
        <xforms:setvalue ev:event="DOMActivate" value="xs:int(instance
('req')/start + instance('req')/howmany)"
                                 ref="instance('req')/start"/>
                                 
    </xforms:trigger>


  </td>
  </tr>
  <xforms:variable  name="tagval"
select="if(instance('query-string')='')then 0 else
instance('query-string')"/>
    <xforms:variable  name="tagval" select="if($tagval = 10620) then 0 else
$tagval"/>
    <xforms:variable name="countrows" select="if(xs:int($tagval)= 0) then
count(instance('events-instance')/Event[(ExpirationDate='' or ExpirationDate
&gt; current-date())]) else count
(instance('events-instance')/Event[Tag/TagId=$tagval and (ExpirationDate=''
or ExpirationDate &gt; current-date())])" />
    <xforms:variable name="category"
select="instance('categories-instance')//*[name()='getGroupVocabularyEntries
Return'][*[name()='entryId']=$tagval]/*[name()='name']" />
    <h1>Events->    <xforms:output value= "$category" /></h1>
       
    <xforms:output value="if($countrows=0) then  ' No events exists in this
Category' else ' '" />
        <xforms:output value="xs:int(instance('req')/start)"/>
        <xforms:output value="(xs:int(instance('req')/howmany +
instance('req')/start) - 1)"/>
        <xforms:output ref="instance('events1-instance')"/>
   

-----Original Message-----
From: Hank Ratzesberger [mailto:[hidden email]]
Sent: Saturday, February 07, 2009 3:58 AM
To: [hidden email]
Subject: [ops-users] Re: RE: Re: Paging in xforms


Shrikanth,

I'm sorry I probably can't help you with your code, but I
have done paging with <xf:repeat> groups, and I found it to
work great.

I use a submission to update the instance that the repeat
displays. The next and prev controls submit to that instance,
and the service returns one "page" of data.

I have a control instance with the start position and the number of
"rows" (repeat elements) to display.  And, a value for whether the
next/previous button should be enabled:

<xforms:instance id="query">
        <query xmlns="">
                <start>1</start>
                <howmany>10</howmany>
                <next>false</next> <!-- Enable/disable next and prev buttons
-->
                <prev>true</prev>
        </query>
</xforms:instance>

I bind the next/prev values:

<xforms:bind nodeset="instance('query')"
        <xforms:bind nodeset="start" constraint=". &gt; 0"/>
        <xforms:bind nodeset="howmany" />
        <!-- Readonly if the start - howmany greater than the hits -->
        <xforms:bind nodeset="next"
                readonly="boolean-from-string(.)"
                calculate="(instance('query')/start +
instance('query')/howmany)  
&gt; instance('events')/hits"/>
        <!-- Readonly if the start - howmany less than 1 -->
        <xforms:bind nodeset="prev"
                readonly="boolean-from-string(.)"

                calculate="(instance('query')/start -
instance('query')/howmany)  
&lt; 1"/>
</xforms:bind>

I group controls for the next and prev (well, maybe group is not  
required), and
set values for the <start> element :

<xforms:group ref="instance('query')">
        <!-- The Prev button subtracts 10 from _start and redraws. -->
        <span style="float: left"><xforms:trigger ref="prev">
                <xforms:label>&lt;&lt; Prev</xforms:label>
                <xforms:action ev:event="DOMActivate">
                        <xforms:setvalue ref="instance('query')/start"
value="instance
('query')/start - instance('query')/howmany"/>
                        <!-- sumbission.... -->
                </xforms:action>
        </xforms:trigger></span>

        <!-- The Next button adds 10 to _start and redraws the map -->

        <span style="float: right"><xforms:trigger ref="next">
                <xforms:label>Next &gt;&gt;</xforms:label>
                <xforms:action ev:event="DOMActivate">
                        <!-- Do set the start position and the cached query
-->
                        <xforms:setvalue ref="instance('query')/start"
value="instance
('query')/start + instance('query')/howmany"/>
                        <!-- submission here, it uses start and howmany -->
                </xforms:action>
        </xforms:trigger></span>

        <strong> Events <xforms:output value="start"/> to <xforms:output  
value="start + howmany - 1"/> </strong>

</xforms:group>

I don't show it, but I also do a submit that has the effect of  
updating the
instance that gets displayed in the repeat.

If that even helps...hope so.

--Hank


On Feb 6, 2009, at 12:07 AM, Srikanth A wrote:

>
> Hello Florian
>
> I have implemented paging in xforms using previous, next buttons
>
> <xforms:instance  id="page">
>                 <page xmlns="">0</page>
>
>           </xforms:instance>
> <xforms:instance id="req">
>                <req xmlns="">
>                    <previous/>
>                    <next/>
>
>                    </req>
>                </xforms:instance>
>
> <xforms:bind nodeset="instance('req')/previous"
> readonly="xs:int(instance('page')) = 0 "/>
> <xforms:bind nodeset="instance('req')/next"
> readonly="(xs:int(instance('page')) = ($pages - 1))" />
> ----------------------------------------------------------------------
> ------
> Variable for count number of pages
>
> <xforms:variable name="pages" select="if(xs:int($tagval)= 0) then
> ceiling(count(instance('events-instance')/Event[(ExpirationDate='' or
> ExpirationDate &gt; current-date())]) div 4) else ceiling(count
> (instance('events-instance')/Event[Tag/TagId=$tagval and  
> (ExpirationDate=''
> or ExpirationDate &gt; current-date())]) div 4)" />
>
>
> ----------------------------------------------------------------------
> ------
> Previous next buttons
> <xforms:trigger ref="instance('req')/previous" appearance="minimal">
>         <xforms:label><xhtml:img
> src="/../eventsxpl/image/previous.png"/></xforms:label>
>
>         <xforms:setvalue ev:event="DOMActivate" value="instance
> ('page')- 1"
>                          ref="instance('page')"/>
>
>     </xforms:trigger >
>     </td>
>     <td>
>     <xforms:trigger ref="instance('req')/next" appearance="minimal">
>         <xforms:label><xhtml:img src="/../eventsxpl/image/next.png"/>
> </xforms:label>
>
>         <xforms:setvalue ev:event="DOMActivate" value="instance
> ('page')+ 1"
>                                  ref="instance('page')"/>
>
>     </xforms:trigger>
> ----------------------------------------------------------------------
> ------
>
> Repeat condition
>
> <xforms:repeat id="event-repeat"
> nodeset="instance('events-instance')/Event[(Tag/TagId=$tagval) and
> (ExpirationDate='' or ExpirationDate &gt; current-date()) and  
> (position()
> gt number(instance('page'))* 4 and position() le
> (number(instance('page')+1))* 4) ]" >
> ----------------------------------------------------------------------
> ------
>
> Issues:
>
> 1)it is displaying irrelevant number of records example: if the  
> limit is to
> display 4 records it is displaying 3 records
>
> 2)  if there are no records to display the next button is enabled
>
> 3)  The repeat condition is not filtering the records properly
>    Example: in the above repeat it should display the records based  
> on tagid
> it is displaying the records but it is also showing a record(blank)  
> which is
> Not satisfied by the repeat condition(***NOTE*** when the number of  
> records
> to display is 1)
>
> 4) I have to tried to print the position() value it is displaying  
> always 1
>     But records are diplayed when the condition is failed.
>
> Excuse me for this big mail. I need to fix this issues
>
> Thanks
> Srikanth
>
>
>
>
>
>
>
> -----Original Message-----
> From: Florian Schmitt [mailto:[hidden email]]
> Sent: Wednesday, January 28, 2009 4:51 PM
> To: [hidden email]
> Subject: [ops-users] Re: Paging in xforms
>
> Srikanth,
>
>> How to list the entries in pages like 10 entries for each page
>
> there are some threads regarding that issue in the list archive:
> http://www.nabble.com/forum/Search.jtp?forum=2537&local=y&query=paging
>
> for example:
> http://www.nabble.com/Re%3A-Paging-issue-p13166304.html
>
> xforms:repeat-number was reported to be not supported in mid 2007:
> http://www.nabble.com/Re%3A-RES%3A-detecting-the-current-repeat- 
> index-p11942
> 718.html
>
> and as there are some workarounds to implement paging, i think it  
> still
> doesn't have high priority.
>
>
> hth
> florian
>
> <upcomingevents.xhtml>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042








--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: RE: Re: Paging in xforms

Alessandro Vernet
Administrator
On Feb 9, 2009, at 11:14 PM, Srikanth A wrote:

> how to use start and Howmany elements in submission I have used as  
> mentioned
> below but the instance is not filled with  data

You are querying data in eXist, right?

If you are, the idea is to add query parameters _start and _howmany.  
You can see how this works in this part of the eXist documentation:

http://exist.sourceforge.net/devguide_rest.html

Maybe as a first step, you can try to write the _howmany and _start  
statically in the URL (resource attribute), to see if you get the  
expected result.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: RE: Re: RE: Re: Paging in xforms

Hank Ratzesberger

Shrikanth,

Yes, that is what I am doing, using eXist.  The principle, even if  
you don't
use eXist, is to have your next and previous controls trigger a  
submission
that changes the instance, which will cause it to be redrawn.

(Sorry to miss your message earlier.)

--Hank

On Feb 11, 2009, at 11:48 AM, Alessandro Vernet wrote:

> On Feb 9, 2009, at 11:14 PM, Srikanth A wrote:
>
>> how to use start and Howmany elements in submission I have used as  
>> mentioned
>> below but the instance is not filled with  data
>
> You are querying data in eXist, right?
>
> If you are, the idea is to add query parameters _start and  
> _howmany. You can see how this works in this part of the eXist  
> documentation:
>
> http://exist.sourceforge.net/devguide_rest.html
>
> Maybe as a first step, you can try to write the _howmany and _start  
> statically in the URL (resource attribute), to see if you get the  
> expected result.
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> Orbeon's Blog: http://www.orbeon.com/blog/
> Personal Blog: http://avernet.blogspot.com/
> Twitter - http://twitter.com/avernet
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: Re: RE: Re: RE: Re: Paging in xforms

srikanth.prodigy

Hello Hank,

I call a XPL to get total events records instance  I have to query that
instance with start and how many in xforms:submission  
I have used howmany and start elements in submission like below

<xforms:submission id="page-events"
resource="/portlet-welcome/geteventscollection" separator="&amp;"
replace="instance" method="get"
ref="instance('events-instance')/Events[(position() ge
instance('req')/start) and (position() lt xs:int(instance('req')/start +
instance('req')/howmany))) ]" />

I have used this submission when user clicks on next button but the instance
is not getting filled

Is my submission condition correct?

How did you wrote your submission ?

Thanks,
Srikanth A


-----Original Message-----
From: Hank Ratzesberger [mailto:[hidden email]]
Sent: Thursday, February 12, 2009 2:32 AM
To: [hidden email]
Subject: [ops-users] Re: Re: RE: Re: RE: Re: Paging in xforms


Shrikanth,

Yes, that is what I am doing, using eXist.  The principle, even if you don't
use eXist, is to have your next and previous controls trigger a submission
that changes the instance, which will cause it to be redrawn.

(Sorry to miss your message earlier.)

--Hank

On Feb 11, 2009, at 11:48 AM, Alessandro Vernet wrote:

> On Feb 9, 2009, at 11:14 PM, Srikanth A wrote:
>
>> how to use start and Howmany elements in submission I have used as
>> mentioned below but the instance is not filled with  data
>
> You are querying data in eXist, right?
>
> If you are, the idea is to add query parameters _start and _howmany.
> You can see how this works in this part of the eXist
> documentation:
>
> http://exist.sourceforge.net/devguide_rest.html
>
> Maybe as a first step, you can try to write the _howmany and _start
> statically in the URL (resource attribute), to see if you get the
> expected result.
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's
> Blog: http://www.orbeon.com/blog/ Personal Blog:
> http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042








--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: Re: RE: Re: RE: Re: Paging in xforms

Hank Ratzesberger

Hi Srikanth,

My first point is that XForms will redraw any repeat section if the
referenced nodeset changes. And, that if the instance
contains all the items on the page (even if only one) you don't have
to put any filters, etc. (that's just one solution, Orbeon Forms
will actually re-evaluate if you have filter statements that
reference other instances that change, but I am getting off point.)

For me, using eXist can really make things simple because I only have
to add xml documents to a collection and then I can query across the
whole collection with the url parameters _start and _howmany.

This is an example of such a query:

http://db.nees.ucsb.edu/exist/rest?_query=collection('/db/cluster/ 
origins')/origins/origin&_howmany=10&_start=101

In your case, it seems that you have a single document with all the
elements and you ask for those elements by position.  I would expect
this to work.  And your next and previous triggers would change the
start and howmany using a setvalue element then submit the page-events.

Cheers,
Hank


On Feb 11, 2009, at 9:49 PM, Srikanth A wrote:

>
> Hello Hank,
>
> I call a XPL to get total events records instance  I have to query  
> that
> instance with start and how many in xforms:submission
> I have used howmany and start elements in submission like below
>
> <xforms:submission id="page-events"
> resource="/portlet-welcome/geteventscollection" separator="&amp;"
> replace="instance" method="get"
> ref="instance('events-instance')/Events[(position() ge
> instance('req')/start) and (position() lt xs:int(instance('req')/
> start +
> instance('req')/howmany))) ]" />
>
> I have used this submission when user clicks on next button but the  
> instance
> is not getting filled
>
> Is my submission condition correct?
>
> How did you wrote your submission ?
>
> Thanks,
> Srikanth A
>
>
> -----Original Message-----
> From: Hank Ratzesberger [mailto:[hidden email]]
> Sent: Thursday, February 12, 2009 2:32 AM
> To: [hidden email]
> Subject: [ops-users] Re: Re: RE: Re: RE: Re: Paging in xforms
>
>
> Shrikanth,
>
> Yes, that is what I am doing, using eXist.  The principle, even if  
> you don't
> use eXist, is to have your next and previous controls trigger a  
> submission
> that changes the instance, which will cause it to be redrawn.
>
> (Sorry to miss your message earlier.)
>
> --Hank
>
> On Feb 11, 2009, at 11:48 AM, Alessandro Vernet wrote:
>
>> On Feb 9, 2009, at 11:14 PM, Srikanth A wrote:
>>
>>> how to use start and Howmany elements in submission I have used as
>>> mentioned below but the instance is not filled with  data
>>
>> You are querying data in eXist, right?
>>
>> If you are, the idea is to add query parameters _start and _howmany.
>> You can see how this works in this part of the eXist
>> documentation:
>>
>> http://exist.sourceforge.net/devguide_rest.html
>>
>> Maybe as a first step, you can try to write the _howmany and _start
>> statically in the URL (resource attribute), to see if you get the
>> expected result.
>>
>> Alex
>> --
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise  
>> Orbeon's
>> Blog: http://www.orbeon.com/blog/ Personal Blog:
>> http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email]
>> mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> Hank Ratzesberger
> NEES@UCSB
> Institute for Crustal Studies,
> University of California, Santa Barbara
> 805-893-8042
>
>
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Paging in xforms

venkata subrahmanyam
In reply to this post by srikanth.prodigy
Hi,
We have been using the following logic for 2 years for paging in xforms.

1) I am filtering the data in the model (XPL ) part itself using queries. To increase the performance while retriving itself based on the page-size only
10 records only I am fetching from the database queries ( using rownumber etc..)


2) Declared 4 variables

        <xsl:variable name="row-count" select="/records/totalrecords" as="xs:integer"/>
        <xsl:variable name="current-page-number" select="/records/filters/page-number" as="xs:integer"/>       
        <xsl:variable name="page-size"  select="/records/page-size" as="xs:integer"/>
        <xsl:variable name="last-page-number" select="($row-count + $page-size - 1) idiv $page-size" as="xs:integer"/>


3) displaying the select button and other next, preve, last etc...  based on the variables data and page-number. The selected page-number should be send with the submission
and retrived again to disable the unwanted buttons.
        .......
        .....
               
<xforms:group ref=".[//report/nopagenation = 'false']">

               
                                                                                                              </xforms:group>
                       
                         
                   
       
                 <xsl:variable name="page-list" select="(1 to $last-page-number)" as="xs:integer*"/> 
                          <xforms:select1 ref="instance('main-instance')//filters/page-number" appearance="minimal">
             <xsl:for-each select="$page-list">
                                    <xforms:item> 
                                          <xforms:label><xsl:value-of select="."/></xforms:label> 
                                          <xforms:value><xsl:value-of select="."/></xforms:value> 
                                    </xforms:item> 
                 </xsl:for-each> 
                                  <xforms:action ev:event="xforms-value-changed">
                                        <xforms:setvalue ref="instance('main-instance')//submittedvalue">ExecuteFullFilter</xforms:setvalue>
                          <xforms:send submission="Execute-Filter"/>
                                  </xforms:action>
                          </xforms:select1>
                       
                                  <xsl:choose>
                                        <xsl:when test="$current-page-number > 1">
                                            <xforms:group>
                                            <xforms:action ev:event="DOMActivate">
                                             <xforms:setvalue ref="instance('main-instance')//filters/page-number" value="1"/>                                         
              <xforms:setvalue ref="instance('main-instance')//submittedvalue">ExecuteFullFilter</xforms:setvalue>
                                                <xforms:send submission="Execute-Filter"/>
                                             </xforms:action>
                                            <xforms:trigger appearance="xxforms:image">
                                               <xforms:label>First</xforms:label>
                                                <xxforms:img src="/images/icons-20x20/first-page.png"/>
                                            </xforms:trigger>                         
                                           </xforms:group>       
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:text> </xsl:text>
                                        </xsl:otherwise>
                                    </xsl:choose>
                         
                                    <xsl:choose>
                                        <xsl:when test="$current-page-number > 1">
                                           <xforms:group>
                                            <xforms:action ev:event="DOMActivate">
                                              <xforms:setvalue ref="instance('main-instance')//filters/page-number" value="{$current-page-number} -1"/>
              <xforms:setvalue ref="instance('main-instance')//submittedvalue">ExecuteFullFilter</xforms:setvalue>
                                                <xforms:send submission="Execute-Filter"/>
                                            </xforms:action>
                                            <xforms:trigger appearance="xxforms:image">
                                            <xforms:label>Prev</xforms:label>
                                             <xxforms:img src="/images/icons-20x20/previous.png"/>
                                            </xforms:trigger>                         
                                           </xforms:group>                         
                                        </xsl:when>
                                         <xsl:otherwise>
                                            <xsl:text> </xsl:text>
                                        </xsl:otherwise>
                                    </xsl:choose>
                           
                                    <xsl:choose>
                                        <xsl:when test="$current-page-number &lt; $last-page-number">
                                          <xforms:group>
                                               <xforms:action ev:event="DOMActivate">
                                               <xforms:setvalue ref="instance('main-instance')//filters/page-number" value="{$current-page-number} +1"/>
                <xforms:setvalue ref="instance('main-instance')//submittedvalue">ExecuteFullFilter</xforms:setvalue>
        <xforms:send submission="Execute-Filter"/> 
                                               </xforms:action>
                                                <xforms:trigger appearance="xxforms:image">
                                                <xforms:label>Next</xforms:label>
                                                <xxforms:img src="/images/icons-20x20/next.png"/>
                                               </xforms:trigger>                         
                                          </xforms:group>                                       
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:text> </xsl:text>
                                        </xsl:otherwise>
                                    </xsl:choose>
                         
                                    <xsl:choose>
                                        <xsl:when test="$current-page-number &lt; $last-page-number">
                                             <xforms:group>
                                               <xforms:action ev:event="DOMActivate">
                                               <xforms:setvalue ref="instance('main-instance')//filters/page-number" value="{$last-page-number}"/>
                <xforms:setvalue ref="instance('main-instance')//submittedvalue">ExecuteFullFilter</xforms:setvalue>
                                                <xforms:send submission="Execute-Filter"/>
                                               </xforms:action>
                                               <xforms:trigger appearance="xxforms:image">
                                                <xforms:label>Last</xforms:label>
                                                <xxforms:img src="/images/icons-20x20/last-page.png"/>
                                               </xforms:trigger>                         
                                          </xforms:group>       
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:text> </xsl:text>
                                        </xsl:otherwise>
                                    </xsl:choose>
                         
Total: <xforms:output ref="//totalrecords"/>

4) displaying the data as only 10 records xml is generated from model. If we have a rown number generated for each record
then we can limit the data also

............... display data in a table using xforms:repeat

<xforms:repeat nodeset="/records/record">
 <xsl:if test="(((rownum &gt;=1) and (rownum  &lt;=$page-size)) )"> 
                               
 <xsl:if>
 
 </xforms:repeat>
 
        <xforms:output ref="empno"/>
       
                <xforms:output ref="empname"/>
       
        <xforms:output ref="empsal"/>
       
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: Re: RE: Re: RE: Re: Paging in xforms

Alessandro Vernet
Administrator
In reply to this post by srikanth.prodigy
Srikanth,

On Feb 11, 2009, at 9:49 PM, Srikanth A wrote:

> <xforms:submission id="page-events"
> resource="/portlet-welcome/geteventscollection" separator="&amp;"
> replace="instance" method="get"
> ref="instance('events-instance')/Events[(position() ge
> instance('req')/start) and (position() lt xs:int(instance('req')/
> start +
> instance('req')/howmany))) ]" />


This submission doesn't look right. Try instead to have  
ref="instance('req')". That should pass the start and howmany as  
request parameters to your /portlet-welcome/geteventscollection  
service. Then of course you need to implement that service to take  
those value into account.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws