on 12-28-2007 7:18 AM
Hi all,
I have to make few rows of my table UI readonly according to the data in the columns of a particular row ,How can i do it. Please help me by giving me the code for that.I give fullll points for the answer. and it is really URGENT.
Regards,
Sharan.
Edited by: Armin Reichert on Dec 30, 2007 7:48 PM
Hi Saisharan,
In order to make only some rows readonly, you can define, a boolean type context attribute in the context node, with which you have bind the table. i.e bind the Datasource property of the table.
Now, bind this context attribute, to the readonly property of all the celleditors that you want to make readonly.
While adding elements to the context node, i.e adding rows to the table, in your code, for each row, that you want to make readonly, set this context attribute as true. For others, set it to false.
In this way, it will make only that rows readonly, where it is true.
Hope it helps.
Regards,
Alka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
As far as i understand, you can make the entire table readonly.
i was checking the same on my NWDS.
it does not seem that you can make rows or colums readonly selectively...
regards,
-Ag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You have already created a table.
And you want to make cell editor as read only for few columns.
In the data source node of the table create boolean attribute for columns which you want to make read only.
Let say you have only one column you want to make it read only for some reason.
(1) Create a boolean attribute "readonlyColumn" in the data source node of the table.
(2) Bind this attribute with the readonly property of the cell editor in the column.
Now your logic comes.
you will iterate through all the elements of the Table Node
Iterator attrIterator = wdContext.nodeTable().getNodeInfo().iterateAttributes();
for (int i = 0; i < wdContext.nodeTable().size(); i++) {
IWDNodeElement element = wdContext.nodeTable().getElementAt(i);
while (attrIterator.hasNext()) {
IWDAttributeInfo elem = (IWDAttributeInfo) attrIterator.next();
String attrName=elem.getName();
Object value=element.getAttributeValue(attrName);
if(condition for value is satisfied){
//Set column read only here
element.setAttributeValue("readonlyColumn",true);
}else{
element.setAttributeValue("readonlyColumn",false);
}
}
}
This code will solve your problem.
It will make the column readonly for the rows you want.
Feel free to ask queries.
Regards,
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a calculated attribute under the node which is bound to the table
Set its datatype as boolean
You will have a get/set Methods created for the calculatted attribute
In the get Method
public boolean getTableNodeReadOnly(IPrivateTView.ITableNodeElement element)
{
//@@begin getTableNodeReadOnly
if( < Your Condition> ) // Put the condition on which you need to disable the columns
return false;
return true;
//@@end
}
bind this attribute to the readOnly property of the UI Element for the column.
OR
1) Create an attribute of type boolean
2) set this attribute to false
Ex: wdContext.currentContextElement().setReadOnly(true); // ReadOnly is the name of the attribute.
3) bind this to the readOnly property of the UI element which is under the TableColumn.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.