on 06-05-2009 9:24 AM
Hello everyone,
In my wdDoModifyView() method, I have the following code:
if (firstTime) {
wdThis.wdGetContactenController().getContacten();
int size = tHistorisch.numberOfColumns();
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Cols = '"+size+"'");
}
In this, tHistorisch is an IWDTable. The data is retrieved in the controller's getContacten() method, which as you can see, is called. When run, it shows content (28 rows worth, in fact) so the DataSource is valid, and the table has the 10 columns that I gave it when I used Apply Template. Yet, the output of the above code is:
Cols = '0'
Can anyone shed any light on this? Thanks in advance.
Regards,
Kars Meyboom.
Edited by: Kars Meyboom on Jun 5, 2009 10:25 AM
Probably this is a new table that uses the "GroupedColumns" aggregation and not the deprecated "Columns" aggregation. Change your code to print numberOfGroupedColumns().
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you create the table dynamically or at design time?
Try this code:
IWDTableColumn[] tableColumns=table.getColumns();
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("size "+tableColumns.length);
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, I tried the snippet of code on completely different table in a completely different WebDynpro component (adapting it, obviously, for the table in question). This time I did get the right number of colums returned.
Both tables were created at design time, I've gone through their property list to see if there was anything radically different but there wasn't. Did my NWDS screw up somewhere? I've found that the WebDynpro code generator isn't the most reliable piece of the NWDS puzzle...
Hi,
Can you explain what is the reason you are trying to get the no Of Columns. Is this because you are not able to see these columns at design time/ runtime (Or) Is this becuase are you not able to see the data at runtime in the table for all the columns? What is the exact issue?
Regards,
Charan
I can see everything just fine; in the browser the table shows up perfectly, showing the expected data.
The exact issue is that I'm trying to use TableSorter to allow users to sort the table. But the thing isn't working. Meaning the column headings don't become clickable like they're supposed to.
I've been looking at the code for TableSorter, and decided to do some runtime inspection, hence my reason for looking at the numberOfColumns() method. And I think that explains TableSorter's behaviour; since it doesn't find any columns, it can't very well make them sortable, now can it?
I've used the exact same strategy about two years ago on a completely different table in a different WebDynpro DC, and it works just fine there. Right now I'm hacking together a local DC to check if the problem occurs there, too.
Regards,
Kars.
Okay, just to be thorough, here's what I did:
- Created a local WebDynpro DC TableTest_WDP
- Added a TableTestComp and TableTestView
- Defined a "Contacts" value node on the view's context with four attributes LastName, FirstName, Email and Phone
- used Apply Template on the root element in the view to generate a four-column table for the Contacts
- Added the following code in the doModifyView() method:
IWDTable table = (IWDTable) view.getElement("Table");
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("num cols = "+table.numberOfColumns());
- Created a TableTest_App application
- Built the DC, and used Deploy New Archive and Run
That gave me an empty table, and the message "num cols = 0"
(see the screenshot at [http://analyser.oli.tudelft.nl/sdn/TableTest.jpg] )
Edited by: Kars Meyboom on Jun 5, 2009 11:55 AM
Hi,
If you create table using Template by default it creates grouped columns Not normal colums. So you have to get the size of grouped columns.
In NW2004S
IWDTable table = (IWDTable) view.getElement("Table");
IWDAbstractTableColumn[] tableColumns=table.getGroupedColumns();
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("size "+tableColumns.length);
Regards,
Charan
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.