cancel
Showing results for 
Search instead for 
Did you mean: 

how to make few columns in the table readonly?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks Mr.pandey that was the logic i used.

Former Member
0 Kudos

Hi Saisharan,

U r Welcome.. and its Ms. Panday.

Regards,

Alka.

Answers (3)

Answers (3)

amolgupta
Active Contributor
0 Kudos

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.

former_member485701
Active Participant
0 Kudos

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

Former Member
0 Kudos

Hi

will this make only few inputfields in my celleditor of column as read only or the complete column as readyonly?? coz i have to be able to make only few celleditors in a particular column as read only.

Sharan

Former Member
0 Kudos

Hi Saisharan,

Try to use Table cell variant for this requirement.

regards

Sumit

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Thanks for the response but thing is i have to make a row and rows above them readonly and rows below the given condtion data to be normal.

Sharan

Former Member
0 Kudos

Hi,

For rows you have to bind to readonly property of the table.

Regards

Ayyapparaj