Re: Grid custom no field

abangkis <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAGqeSzXLD4mw1Dm7vGBX=tP32ndedGSwSi1kxU_qgEQVdM70kA@mail.gmail.com>
Hi chris and geoff, I guess creating a component or mixin is the best
approach. Thanks.

On Thu, Apr 19, 2018 at 5:12 PM, JumpStart <
[email protected]> wrote:

> Or a mixin?
>
>         http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/
> creatingmixins
>         http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/
> gridbeanmodel1
>
> Geoff
>
> > On 19 Apr 2018, at 2:20 pm, Chris Poulsen <[email protected]>
> wrote:
> >
> > Create a component?
> >
> > --
> > Chris
> >
> > On Thu, Apr 19, 2018 at 5:53 AM, abangkis <[email protected]> wrote:
> >
> >> Hi, when adding a custom no field to my grid, to show the no of the
> actual
> >> row, i declared an int on the page and calculate the value by
> multiplying
> >> the variables in the grid like the code bellow.
> >>
> >> Is there a way to do this automatically, since for now i'm doing it
> >> manually by copy and pasting the code to every page that uses grid.
> >>
> >> Thank you verymuch
> >>
> >> <table t:id="grid" t:type="grid" t:source="loans" t:row="loan"
> >> rowIndex="idx" t:inPlace="true"
> >>       t:add="no">
> >>    <p:noCell>
> >>        ${idx}
> >>    </p:noCell>
> >> </table>
> >>
> >> @InjectComponent
> >> private Grid grid;
> >>
> >> private int idx;
> >>
> >>
> >> public void setIdx(int idx) {
> >>    this.idx = idx;
> >> }
> >>
> >> public int getIdx() {
> >>    return grid.getRowsPerPage() * (grid.getCurrentPage() - 1) + idx + 1;
> >> }
> >>
> >>
> >> --
> >> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> >> twitter : @mreunionlabs @abangkis
> >> page : https://plus.google.com/104168782385184990771
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.