on 12-29-2009 1:32 PM
Hello,
I have a table that has 10 columns with the same prefix (Labst01,Labst02,...,Labst10) and i get number of columns to display.
I thought of changing programmatically the visible attribute of the columns that are not relevant at the same run result.
Does anyone has a code sample or guidlines?
Thanks
Moshe
Hi,
you can make a node with 10 Attributes of the type com.sap.ide.webdynpro.uielementdefinitions.Visibility.
Name the attributes like LabstVisible1, LabstVisible2,...
Then bind the Visibility of the columns to the Context attributes.
At Runtime you can set the Visibility like:
//set every column invisible
for (int i = 1; i <= 10; i++) {
wdContext.currentVisiblePermissionElement().setAttributeValue("LabstVisible" + i, WDVisibility.NONE);
}
//set columns visible depending on amount of columns
for (int i = 1; i <= countOfColumns; i++) {
wdContext.currentVisiblePermissionElement().setAttributeValue("LabstVisible" + i, WDVisibility.VISIBLE);
}
For any help, please ask.
Best regards,
Peter
Edited by: Peter Irk on Dec 29, 2009 3:06 PM
Edited by: Peter Irk on Dec 29, 2009 3:07 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
have you created the Node VisiblePermissionElement and added at least one Elemen?
You can set the attributes for each column direct in context, but I prefer to keep them in a Node.
If you have the attributes direct in the context, you must use this code:
//set every column invisible
for (int i = 1; i <= 10; i++) {
wdContext.currentContextElement().setAttributeValue("LabstVisible" + i, WDVisibility.NONE);
}
//set columns visible depending on amount of columns
for (int i = 1; i <= countOfColumns; i++) {
wdContext.currentContextElement().setAttributeValue("LabstVisible" + i, WDVisibility.VISIBLE);
}
Ah, ok now I know what you mean.
Then I would rename the Columns to Labst1, Labst2, ... Labst10.
Set all Columns to visible in the view.
In the Method wdDoModifyView of the view write this code:
IWDTableColumn col;
for (int i = 10; i > countOfColumnsToDisplay; i--) {
col = (IWDTableColumn) view.getElement("Labst" + i);
col.setVisible(WDVisibility.NONE);
}
Hi
You can do this in two ways either by binding all th table columns visiblity property to ten attributes and then programattically setting it.
or you can directly access the table colomn in the wddomodifyview() method and set its visiblity. as shown below:-
public static void wdDoModifyView(IPrivateTest2View wdThis, IPrivateTest2View.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
IWDTableColumn tc = (IWDTableColumn)view.getElement(<here write the coumn id>);
tc.setVisible(WDVisibility.NONE);
//@@end
}
hope this will help
sarbjeet
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.