hi,Erwin!

Thank you so fast and accurate response!
That's great help to me!

2010/5/11 Erwin Bolwidt <[email protected]>
>
> Hi,
>
> You can do it like this:
>
> private private DefaultDataTable<T> dataTable;
>
> // ...
>
> new AbstractColumn<WeekSchema>(new Model<String>("#")) {
> public void populateItem(Item<ICellPopulator<WeekSchema>> cellItem,
> String componentId,
> IModel<WeekSchema> rowModel) {
> Item<?> item = (Item<?>) cellItem.getParent().getParent();
> int index = dataTable.getCurrentPage() * dataTable.getRowsPerPage() +
> item.getIndex() + 1;
> cellItem.add(new Label(componentId, String.valueOf(index)));
> }
> }
>
> Regards,
> Erwin Bolwidt
>
>
> On 5/11/10 9:56 AM, cleverpig wrote:
> > hi,everybody!
> >
> > I used this way to build dataTable:
> > DataProvider+Column defines+DataTable.
> >
> > I want to add a index column at the first column,and hope that keeping
> > continuous index number.
> > So whenever turn to another page it will hold continuously,just not
> > renew from 1.
> >
> > But now,I can get a sample code to implement index number in each
> > page,not ontinuous index number yet.
> >
> > IColumn[] columns={
> >       new AbstractColumn(new ResourceModel("column.index")){
> >
> >               private static final long serialVersionUID = 0L;
> >
> >                       @Override
> >                       public void populateItem(Item cellItem, String 
> > componentId, IModel
> > rowModel) {
> >                               Item 
> > item=(Item)cellItem.getParent().getParent();
> >                               cellItem.add(new Label(componentId,new 
> > Model(item.getIndex()+1)));
> >                       }
> >               },
> >       ...
> > };
> >
> > DataTable dataTable=new DataTable("entries",columns,dataProvider,5);
> > ...
> >
> > How to make continous row index in dataTable? Hoping that the wise
> > friend to help me.
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



--
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: [email protected]
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to