You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Alexander Untch <un...@gmail.com> on 2012/03/11 13:22:17 UTC

Pick values from a table

Hello everybody,

I created a click page with a table. The table has 5 columns and x rows.
The table is filled by using table.setRowList(resultList);

Up to this point everything works fine.
But now I need some help. On the rendered page with the table I need
to pick values from the table and pass them to another service (for
example by selecting them in the table and pressing a submit button).

The table looks like this:
col1 col2 col2 col4 col5
-----------------------------------
val1 val2 val3 val4 val5
val6 val7 val8 val9 val10

I need to select val4 and val9 (same column but different rows) and pass them.

At the moment I don't know how to achieve this. Has anybody a great
and simple idea?

Thanks a lot!
Alex

Re: Pick values from a table

Posted by Carlos Lobato <lo...@gmail.com>.
Hi Alex,

I usually do this by way of a for loop in the rowList and the isSelected()
method, for your additional requirement, if isSelected() returns true then
I set the associated value to whichever corresponding TextField and at the
end I would gather everything in a listener method, that is, a Submit
button.

Hope that helps a bit. Cheers,
-Carlos

On Mon, Mar 12, 2012 at 7:30 AM, Alexander Untch <un...@gmail.com> wrote:

> Hi Malcolm and Gilberto,
>
> first of all: thanks for your reply!
>
> @Malcolm
> My table looks like a simple table at the moment [1].
> Don't ask why but the web application I'm implementing is an
> experimental attempt :)
>
> So I have the table with values. The user now should be able to select
> values from the table from different rows of the same column.
> For example by setting a check mark behind each value.
>
> Since yesterday I have another requirement:
> The selected values from the table should be charged with more
> information by the user, before passing them to a service.
> Means: The user selects values. These values will be filled into
> TextFields (for each value a TextField). Beside each TextField with
> the values from the table there should be another TextField in which
> the user can insert additional informations.
> Now all these values and informations should be passed to a service.
>
> I hope my explanation isn't too bad :( In my head it all makes sense
> but describing is very complex.
>
>
> @Gilberto
> Thanks for your hint!
> I will try this as soon as possible.
>
>
> Thanks a lot!
> Alex
>
> [1] http://click.avoka.com/click-examples/introduction/simple-table.htm
>
>
>
> On Mon, Mar 12, 2012 at 13:07, Gilberto <gi...@gmail.com> wrote:
> > You can, as well, create a column Decorator[1] putting more parameters
> there:
> > <quote>
> >   column.setDecorator(new Decorator() {
> >
> >            public String render(Object row, Context context) {
> >                Customer customer = (Customer) row;
> >                String id = String.valueOf(customer.getPerson().getId());
> >
> >                editLink.setParameter("id", id);
> >                deleteLink.setValue(id);
> >
> >                return editLink.toString() + " | "
> >                        + deleteLink.toString();
> >            }
> >        });
> >        table.addColumn(column);
> >
> > </quote>
> >
> > Hth,
> >
> > Gilberto
> >
> > [1]
> http://click.apache.org/docs/click-api/org/apache/click/control/Decorator.html
> >
> >
> > On Sun, Mar 11, 2012 at 8:04 PM, Malcolm Edgar <ma...@gmail.com>
> wrote:
> >> Is this a DataGrid type problem where the user is making a selection?
> >>
> >> http://click.avoka.com/click-examples/table/form-table.htm
> >>
> >> regards
> >>
> >>
> >> On Sun, Mar 11, 2012 at 11:22 PM, Alexander Untch <un...@gmail.com>
> wrote:
> >>>
> >>> Hello everybody,
> >>>
> >>> I created a click page with a table. The table has 5 columns and x
> rows.
> >>> The table is filled by using table.setRowList(resultList);
> >>>
> >>> Up to this point everything works fine.
> >>> But now I need some help. On the rendered page with the table I need
> >>> to pick values from the table and pass them to another service (for
> >>> example by selecting them in the table and pressing a submit button).
> >>>
> >>> The table looks like this:
> >>> col1 col2 col2 col4 col5
> >>> -----------------------------------
> >>> val1 val2 val3 val4 val5
> >>> val6 val7 val8 val9 val10
> >>>
> >>> I need to select val4 and val9 (same column but different rows) and
> pass
> >>> them.
> >>>
> >>> At the moment I don't know how to achieve this. Has anybody a great
> >>> and simple idea?
> >>>
> >>> Thanks a lot!
> >>> Alex
> >>
> >>
>

Re: Pick values from a table

Posted by Alexander Untch <un...@gmail.com>.
Hi Malcolm and Gilberto,

first of all: thanks for your reply!

@Malcolm
My table looks like a simple table at the moment [1].
Don't ask why but the web application I'm implementing is an
experimental attempt :)

So I have the table with values. The user now should be able to select
values from the table from different rows of the same column.
For example by setting a check mark behind each value.

Since yesterday I have another requirement:
The selected values from the table should be charged with more
information by the user, before passing them to a service.
Means: The user selects values. These values will be filled into
TextFields (for each value a TextField). Beside each TextField with
the values from the table there should be another TextField in which
the user can insert additional informations.
Now all these values and informations should be passed to a service.

I hope my explanation isn't too bad :( In my head it all makes sense
but describing is very complex.


@Gilberto
Thanks for your hint!
I will try this as soon as possible.


Thanks a lot!
Alex

[1] http://click.avoka.com/click-examples/introduction/simple-table.htm



On Mon, Mar 12, 2012 at 13:07, Gilberto <gi...@gmail.com> wrote:
> You can, as well, create a column Decorator[1] putting more parameters there:
> <quote>
>   column.setDecorator(new Decorator() {
>
>            public String render(Object row, Context context) {
>                Customer customer = (Customer) row;
>                String id = String.valueOf(customer.getPerson().getId());
>
>                editLink.setParameter("id", id);
>                deleteLink.setValue(id);
>
>                return editLink.toString() + " | "
>                        + deleteLink.toString();
>            }
>        });
>        table.addColumn(column);
>
> </quote>
>
> Hth,
>
> Gilberto
>
> [1] http://click.apache.org/docs/click-api/org/apache/click/control/Decorator.html
>
>
> On Sun, Mar 11, 2012 at 8:04 PM, Malcolm Edgar <ma...@gmail.com> wrote:
>> Is this a DataGrid type problem where the user is making a selection?
>>
>> http://click.avoka.com/click-examples/table/form-table.htm
>>
>> regards
>>
>>
>> On Sun, Mar 11, 2012 at 11:22 PM, Alexander Untch <un...@gmail.com> wrote:
>>>
>>> Hello everybody,
>>>
>>> I created a click page with a table. The table has 5 columns and x rows.
>>> The table is filled by using table.setRowList(resultList);
>>>
>>> Up to this point everything works fine.
>>> But now I need some help. On the rendered page with the table I need
>>> to pick values from the table and pass them to another service (for
>>> example by selecting them in the table and pressing a submit button).
>>>
>>> The table looks like this:
>>> col1 col2 col2 col4 col5
>>> -----------------------------------
>>> val1 val2 val3 val4 val5
>>> val6 val7 val8 val9 val10
>>>
>>> I need to select val4 and val9 (same column but different rows) and pass
>>> them.
>>>
>>> At the moment I don't know how to achieve this. Has anybody a great
>>> and simple idea?
>>>
>>> Thanks a lot!
>>> Alex
>>
>>

Re: Pick values from a table

Posted by Gilberto <gi...@gmail.com>.
You can, as well, create a column Decorator[1] putting more parameters there:
<quote>
   column.setDecorator(new Decorator() {

            public String render(Object row, Context context) {
                Customer customer = (Customer) row;
                String id = String.valueOf(customer.getPerson().getId());

                editLink.setParameter("id", id);
                deleteLink.setValue(id);

                return editLink.toString() + " | "
                        + deleteLink.toString();
            }
        });
        table.addColumn(column);

</quote>

Hth,

Gilberto

[1] http://click.apache.org/docs/click-api/org/apache/click/control/Decorator.html


On Sun, Mar 11, 2012 at 8:04 PM, Malcolm Edgar <ma...@gmail.com> wrote:
> Is this a DataGrid type problem where the user is making a selection?
>
> http://click.avoka.com/click-examples/table/form-table.htm
>
> regards
>
>
> On Sun, Mar 11, 2012 at 11:22 PM, Alexander Untch <un...@gmail.com> wrote:
>>
>> Hello everybody,
>>
>> I created a click page with a table. The table has 5 columns and x rows.
>> The table is filled by using table.setRowList(resultList);
>>
>> Up to this point everything works fine.
>> But now I need some help. On the rendered page with the table I need
>> to pick values from the table and pass them to another service (for
>> example by selecting them in the table and pressing a submit button).
>>
>> The table looks like this:
>> col1 col2 col2 col4 col5
>> -----------------------------------
>> val1 val2 val3 val4 val5
>> val6 val7 val8 val9 val10
>>
>> I need to select val4 and val9 (same column but different rows) and pass
>> them.
>>
>> At the moment I don't know how to achieve this. Has anybody a great
>> and simple idea?
>>
>> Thanks a lot!
>> Alex
>
>

Re: Pick values from a table

Posted by Malcolm Edgar <ma...@gmail.com>.
Is this a DataGrid type problem where the user is making a selection?

http://click.avoka.com/click-examples/table/form-table.htm

regards

On Sun, Mar 11, 2012 at 11:22 PM, Alexander Untch <un...@gmail.com> wrote:

> Hello everybody,
>
> I created a click page with a table. The table has 5 columns and x rows.
> The table is filled by using table.setRowList(resultList);
>
> Up to this point everything works fine.
> But now I need some help. On the rendered page with the table I need
> to pick values from the table and pass them to another service (for
> example by selecting them in the table and pressing a submit button).
>
> The table looks like this:
> col1 col2 col2 col4 col5
> -----------------------------------
> val1 val2 val3 val4 val5
> val6 val7 val8 val9 val10
>
> I need to select val4 and val9 (same column but different rows) and pass
> them.
>
> At the moment I don't know how to achieve this. Has anybody a great
> and simple idea?
>
> Thanks a lot!
> Alex
>