on 07-03-2007 11:32 AM
Hi frnz,
I know how to make the table with alternating color, by changing the table UI properties, design as alternating and readonly as true.
But I need readonly==false and should get the alternating color.
I am getting my data from <b>model directly to the table</b>, which has a check box per row, I need to use that check box and fetch the data. If I make readonly==true then I could not able to do that.
Please help me out how could I achieve <u>Editable table with alternating colors.</u>
Hi Pradeep,
If table is not readonly, u can't make use of standard alternating color property.
Instead u can go for standard table column colors.
In table node, create a variable(say tableDesign) of type TableCellDesign( u can select this type from uielementdefinitions).
For all table columns, bind CellDesign property to this variable.
At the time of creation of table rows, u can create alternate color for rows by
IPrivate<ViewName>View.ITableNode rNode=wdContext.nodeTable();
IPrivate<ViewName>View.ITableElement rEl;
for(int i=0;i<5;i++)
{
rEl=rNode.createTableElement();
rNode.addElement(rEl);
if(i%2==0)
{
rEl.setTableDesign(WDTableCellDesign.GROUP_LEVEL2);
}
else
{
rEl.setTableDesign(WDTableCellDesign.GROUP_LEVEL3);
}
}
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It does not matter if your table node is Model / Value.
You can create a value attribute (TableCellDesign) of type TableCellDesign under the Model Table Node in your View context and map this to the cellDesign property of the table columns.
In your view context
for(int i=0;i<wdContext.nodeTableNode.size();i++)
{
if(i%2==0)
{
IPrivate<your view>.INodeElement ele = wdContext.nodeTableNode.getTableNodeElementAt(i);
ele.setTableCellDesign(WDTableCellDesign.GOODVALUE_DARK);
}
else
{
IPrivate<your view>.INodeElement ele = wdContext.nodeTableNode.getTableNodeElementAt(i);
ele.setTableCellDesign(WDTableCellDesign.GOODVALUE_LIGHT);
}
}
This has worked for me with Model Node.
Hi Hamsa,
Its working if the table node is custom node. My table node is a Bapi(model) node, As you said I added one value node (vnCellDesign) and one value attribute under this value node(vaCellDesign). But when I execute it Indexoutofbound execption is coming. its saying index=0.
I changed the node cardinality to 1..n and also tried with 1..1 but no use still same error is coming.
What might be the problem????
advance thanks
Pradeep
Hi Pradeep,
Hi Pradeep,
Check all steps
1.Create a value node (0..N cardinality). Let it's name be vnCellDesign
2. Create column variables(Say Name, Age) and CellDesignVariable( Say vaCellDesign of type TableCell Design) under vnCellDesign.
3.Bind the variable to table. Bind vaCellDesign to all Column's cellDesign property)
4.Execute master RFC
5.Get values from RFC to TableNode by the following code
IPrivate<ViewName>View.IvnCellDesignNode rNode=wdContext.nodevnCellDesign();
IPrivate<ViewName>View.IvnCellDesignElement rEl;
IPrivate<ViewName>View.I<MasterRFC>Node masterNode=wdContext.node<MasterRFC>();
IPrivate<ViewName>View.I<MasterRFC>Element masterEl;
for(int i=0;i<masterNode.size();i++)
{
msterEl=masterNode.get<MasterRFC>ElementAt(i);
String name=masterEl.getName();//GETTING VALUES FROM RFC
String age=masterEl.getAge();//GETTING VALUES FROM RFC
rEl=rNode.createvnCellDesignElement();
rNode.addElement(rEl);
rEl.setName(name);//SETTING VALUES TO TABLE
rEl.setAge(age);//SETTING VALUES TO TABLE
if(i%2==0)
{
rEl.setvnCellDesign(WDTableCellDesign.GROUP_LEVEL2);//SETTING COLOR TO TABLE ROWS
}
else
{
rEl.setvnCellDesign(WDTableCellDesign.GROUP_LEVEL3);//SETTING COLOR TO TABLE ROWS
}
}
This should work
Regards
Fahad Hamsa
Hi Hamsa,
Is it not possible if I directly bind my table to model node? Is it compulsury to transfer data from model node to custom node and then creating a value node/attribute in custom node then getting the colors?
I want to map table directly to the model node. So now its not possible to get the colors by creating a value node/attirbute in model node?
Thanks in advance
Pradeep
HI Pradeep,
It's possible. But creating seperate node will be more neat and maintainable
and it is a one time effort.
Consider the case, if there is some structure change in RFC.
There u have to create these kind of extra attributes again.
Also, if the model class has a dictionary structure binding, u cant directly
add valueattributes to node. In that case, u have to create an attribute
inside a customnode under the model node. Then complexity will increase.
It's up to u to select the method. But creating attributes inside model node is not preferred, eventhough it is possible
Regards
Fahad Hamsa
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.