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 < geoff.callender.jumpst...@gmail.com> 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 <mailingl...@nesluop.dk> > wrote: > > > > 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 > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/> twitter : @mreunionlabs @abangkis page : https://plus.google.com/104168782385184990771