Create a component?

-- 
Chris

On Thu, Apr 19, 2018 at 5:53 AM, abangkis <abang...@gmail.com> 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
>

Reply via email to