You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by oceatoon <t....@systheo.com> on 2005/05/29 18:31:23 UTC

CForms:Selection List generated Repeater ??

Hi everyone
As I can see there are quite a bit of movement around selection-list, I'll
reopen an old request of mine about repeaters being able to be generated
from a selection list. meaning if a selection list is positionned on a
widget inside a repeater, the repeater will generate as many rows that
contains the selection list.

example:
my repeater contains a label outputfield, and a few field widgets
if the label is made "selectionlistable" this would generate as many rows as
contained in the Selectionlist, with the different labels.

I allready do this programaticaly on binding but it seems to me, its real
place is in the model as a simple declaration.

WDYT?
Regards
Tibor



Re: CForms:Selection List generated Repeater ??

Posted by oceatoon <t....@systheo.com>.
>>filled through binding or on-create listener and this would be yet another
>>initialisation possiblity.

> 
> So what do you suggest: a new "mapped-repeater" widget which extends
> repeater with a selection-list to create the rows?
exactly, the selection-list could be placed on any widget inside the
repeater making that particular widget the base to the generation of the
repeater, all the other widgets are copied as a new row, only the
particular widget has a set value on creation, or there could even be a
more complex selectionlist where each widget would have an initial value
(as attributes of an item).

> There is a problem though: how would the repeater be loaded from
> existing data? What is the role of the selection list in that case?
This repeater could be concidered like a combo (select) with widgets
associated, so we can add or remove elements in the list without worrying
about the other associated widgets. if an item is removed, then the data
wont be accessed anymore (binding rules) , and if an item is added the rows
are empty.

WDYT ?

> 
>>sorry persistent I am.
> 
> This I have seen :-)
lol


Definiton Example
**********
This repeater would be mapped on the label widget and would have 4 rows

<fd:repeater id="myrep">
                <fd:selection-list-map widget="label">
                    <fd:item value="one"/>
                    <fd:item value="two"/>
                    <fd:item value="three"/>
                    <fd:item value="four"/>
                </fd:selection-list-map>
            <fd:widgets>
                <fd:output id="label">
                    <fd:datatype base="string"/>
                </fd:output>
                <fd:field id="text1">
                    <fd:datatype base="string"/>
                </fd:field>
                <fd:field id="text2">
                    <fd:datatype base="string"/>
                     <fd:selection-list src="cocoon://src"/>
                </fd:field>
            </fd:widgets>
        </fd:repeater>


Re: CForms:Selection List generated Repeater ??

Posted by Sylvain Wallez <sy...@apache.org>.
oceatoon wrote:

>Hi Sylvain
>  
>
>>IIUC what you describe here is a kind of Map, where the key set would be
>>the selection list and the values would be the widget rows. Am I right?
>>    
>>
>Yes that right
>  
>
>>I don't think we need a new widget type for this as the repeater is
>>versatile enough. Either a binding or a helper on-create event listener
>>should be what is needed to automate this.
>>    
>>
>Consistent you are, since you gave me the same answer the first time around ;)
>

LOL! I didn't remember my first answer :-)

>And I followed your advise (I use binding JS) but it would make
>the structure a lot simpler, and all definition would be in the model
>(Respect to the SOC ;). 
>It's not a new widget just a new functionality to existing repeaters
>enabling them to be mapped on a selection list. A repeater can only be
>filled through binding or on-create listener and this would be yet another
>initialisation possiblity.
>  
>

So what do you suggest: a new "mapped-repeater" widget which extends 
repeater with a selection-list to create the rows?

There is a problem though: how would the repeater be loaded from 
existing data? What is the role of the selection list in that case?

>sorry persistent I am.
>  
>

This I have seen :-)

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: CForms:Selection List generated Repeater ??

Posted by oceatoon <t....@systheo.com>.
Hi Sylvain
> IIUC what you describe here is a kind of Map, where the key set would be
> the selection list and the values would be the widget rows. Am I right?
Yes that right
> I don't think we need a new widget type for this as the repeater is
> versatile enough. Either a binding or a helper on-create event listener
> should be what is needed to automate this.
Consistent you are , since you gave me the same answer the first time
around ;), And I followed your advise (I use binding JS) but it would make
the structure a lot simpler, and all definition would be in the model
(Respect to the SOC ;). 
It's not a new widget just a new functionality to existing repeaters
enabling them to be mapped on a selection list. A repeater can only be
filled through binding or on-create listener and this would be yet another
initialisation possiblity.
sorry persistent I am.

Regards
Tibor



Re: CForms:Selection List generated Repeater ??

Posted by Sylvain Wallez <sy...@apache.org>.
oceatoon wrote:

>Hi everyone
>As I can see there are quite a bit of movement around selection-list, I'll
>reopen an old request of mine about repeaters being able to be generated
>from a selection list. meaning if a selection list is positionned on a
>widget inside a repeater, the repeater will generate as many rows that
>contains the selection list.
>
>example:
>my repeater contains a label outputfield, and a few field widgets
>if the label is made "selectionlistable" this would generate as many rows as
>contained in the Selectionlist, with the different labels.
>
>I allready do this programaticaly on binding but it seems to me, its real
>place is in the model as a simple declaration.
>  
>

IIUC what you describe here is a kind of Map, where the key set would be 
the selection list and the values would be the widget rows. Am I right?

I don't think we need a new widget type for this as the repeater is 
versatile enough. Either a binding or a helper on-create event listener 
should be what is needed to automate this.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: CForms:Selection List generated Repeater ??

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Antonio Gallardo wrote:
> On Dom, 29 de Mayo de 2005, 11:31, oceatoon dijo:
> 
>>Hi everyone
>>As I can see there are quite a bit of movement around selection-list, I'll
>>reopen an old request of mine about repeaters being able to be generated
>>from a selection list.
> 
> 
>>Meaning if a selection list is positionned on a
>>widget inside a repeater, the repeater will generate as many rows that
>>contains the selection list.
> 
> 
> Do you mean to feed a Repeater from an Array?
> 
> 
>>Example:
>>my repeater contains a label outputfield, and a few field widgets
>>if the label is made "selectionlistable" this would generate as many rows
>>as contained in the Selectionlist, with the different labels.
> 
> 
>>I already do this programaticaly on binding but it seems to me, its real
>>place is in the model as a simple declaration.
> 
> 
> Not sure if this is the same I have in mind. But it can helps when showing
> results of a search. For example, in one form whe show the posible
> criteria for the search, when the users send the request, we consult the
> DB and fetch the rows meeting the result. We are currently using
> jxtemplate for this purpose.
> 
> Thinking in that, a way to save developer time is (and I will also like to
> see it implemented) a "paginatable repeaters" with "back-page",
> "next-page" buttons. or soething similar.
In order to create a paginatable repeater you have two choices:
1. Simpler (hardly usable). You feed the repeater with all the data 
(i.e. 1000 rows) and then paginate showing only 10 at the time. This is 
how paginate transformer works. It is totally unusable for large 
portions of data because of the resources needed to fetch and store data.

2. Harder. You fetch only what you need basing on current view. Some 
kind of modified binding would be needed which would pass an information 
to some function which portion of data is needed. This means that form 
model is no longer 'static'. It's getting harder with every minute: Now 
that you do not hold a full data set you also need to know what is the 
total amount of rows to provide information like 'This is page 2/16'. 
Moreover a paginated repeater is nothing without filtering capabilities 
so apart from knowing the 'window' position you have to pass also some 
filtering attributes to binding function.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Re: CForms:Selection List generated Repeater ??

Posted by oceatoon <t....@systheo.com>.
> Do you mean to feed a Repeater from an Array?
yes but with a selection list. and not in the binding nore on create
It would be in the definition.
> 
>> Example:
>> my repeater contains a label outputfield, and a few field widgets
>> if the label is made "selectionlistable" this would generate as many rows
>> as contained in the Selectionlist, with the different labels.
> 
>> I already do this programaticaly on binding but it seems to me, its real
>> place is in the model as a simple declaration.
> 
> Not sure if this is the same I have in mind. But it can helps when showing
> results of a search. 
Yes if you need to associate widgets to your search result, that's the idea
> For example, in one form whe show the posible 
> criteria for the search, when the users send the request, we consult the
> DB and fetch the rows meeting the result. We are currently using
> jxtemplate for this purpose.
ok
> Thinking in that, a way to save developer time is (and I will also like to
> see it implemented) a "paginatable repeaters" with "back-page",
> "next-page" buttons. or soething similar.
This is a Template problem, not a generation one.
in your case it could easily be solved with jx:template with a forEach tag
(begin end) the index (increments or decrements) is linked to your buttons. 


Regards
Tibor


Re: CForms:Selection List generated Repeater ??

Posted by Antonio Gallardo <ag...@agssa.net>.
On Dom, 29 de Mayo de 2005, 11:31, oceatoon dijo:
> Hi everyone
> As I can see there are quite a bit of movement around selection-list, I'll
> reopen an old request of mine about repeaters being able to be generated
> from a selection list.

> Meaning if a selection list is positionned on a
> widget inside a repeater, the repeater will generate as many rows that
> contains the selection list.

Do you mean to feed a Repeater from an Array?

> Example:
> my repeater contains a label outputfield, and a few field widgets
> if the label is made "selectionlistable" this would generate as many rows
> as contained in the Selectionlist, with the different labels.

> I already do this programaticaly on binding but it seems to me, its real
> place is in the model as a simple declaration.

Not sure if this is the same I have in mind. But it can helps when showing
results of a search. For example, in one form whe show the posible
criteria for the search, when the users send the request, we consult the
DB and fetch the rows meeting the result. We are currently using
jxtemplate for this purpose.

Thinking in that, a way to save developer time is (and I will also like to
see it implemented) a "paginatable repeaters" with "back-page",
"next-page" buttons. or soething similar.

WDYT?

Best Regards,

Antonio Gallardo.