on 09-04-2008 5:11 AM
Hi all,
I want to add a column to a table which shows the the current row number. Is there an easy way to do it?
when i sort the table, i want the column remains the same order.
when i delete one row in middle, it automatically keep the numbering continually
is there a way?
Thanks !
Hi there,
You can add a context attribute under your node.
Do this in the modifyView method
for(int i=0; i<wdContext.nodeCustomer().size(); i++) {
IPrivateMainComponentView.ICustomerElement ele = wdContext.nodeCustomer().getCustomerElementAt(i);
ele.setColumnNumber(i+1);
}
This would ensure that the column number gets "recalculated" everything the view is changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Add a calculated attribute "number" under the table data source "Rows". Implement it like
int getRowsNumber(IRowsElement element)
{
return element.index() + 1;
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using loops does eat up the performance "TECHNICALLY" but don't think that will crash the system. It's fairly manageable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i think of easy way by calling a method which sets numbering manually.
int size = wdContext.nodeTable().size();
for(int i =0; i<size; i++) {
wdContext.nodeTable().getTableElementAt(i).setRowNum(i+1);
// Table - Node name
// RowNum - attribute in Table Node
}
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.