Re: Grid custom no field

Chris Poulsen <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAFKtUSs=hBmsR+8U6GdPKQ7426F6c-Cm1hsC9QNZ+5FO=Ph1Gg@mail.gmail.com>
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
>
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.