cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the property of single cell in a table

Former Member
0 Kudos

Hi,

i have one table with several rows and columns with input fields, i wabt to set single cell property readonly to true or false depends on business logic.

can i set single cell property readonly in a table.

Iam getting the error for the following code, rightnow iam not iterating through a column, just trying to set whole column.

IWDTable table= (IWDTable)view.getElement("ResultsTable");

IWDTableColumn column=(IWDTableColumn) table.getColumn(3);

//wdContext.currentContextElement().setLength(column.length);

IWDInputField IF= (IWDInputField)column;

IF.setReadOnly(true);

//table.iterateColumns();

//@@end

Thanks,

Damodhar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

i have the node structure like following

Zmm_Bapi(modelnode)

Output(modelnode)

po_items(modelnode)

x(modelattribute)

y(modelattribute)

so i binded the x to tablecell of type InputField, depends on the condition of y i want to change the x's input field property to true or flase.

I hope it gives good idea.

i did the following,

po_items(modelnode)

addtionalcolumns ( valuenode,cardinality1..1,selection 1..1,singleton false)

readonly(valueattributeof type boolean)

so iam checking in wdDoModifyView like you said iterating through the node po_items, and checking the valu of Y attribute and assigning true or false to readonly attribute.

the code looks like follows in wdDoModifyView

for(int i=0;i<wdContext.nodePo_Items().size();i++){

if(wdContext.currentPo_Items().getY=="Closed")

{ wdContext.currentAdditionalColumnElement().setReadOnly(true); }

else{

wdContext.currentAdditionalColumnElement().setReadOnly(false);

}

wdContext.nodePo_Items().moveNext();

}

and somehow it is not working, all input fields are editable although Y has value Closed.

may i know where i am doing wrong.

Thanks,

Damodhar.

Former Member
0 Kudos

Several remarks.

First, you should not update the context in method wdDoModifyView(). You could do it after executing the BAPI or in a supply function.

Your code should be changed to


for (int i = 0; i < wdContext.nodePo_Items().size(); i++)
{
  IPo_ItemsElement item = wdContext.nodePo_Items().getPo_ItemsElementAt(i);
  IAdditionalColumnElement additional = item.nodeAdditionalColumn().currentAdditionalColumnElement();
  additional.setReadOnly( "Closed".equals(item.getY() )
}

Armin

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Armin,

Thanks Armin,i implemented in onPlugFromSearch(), its working fine.

Thanks,

Damodhar.

Former Member
0 Kudos

Hi Armin,

i got it but need some help, i don't understand

"Set the attribute value for the node element corresponding to the row (<u>index of node element = row index)."</u>

Thanks,

Damodhar.

Former Member
0 Kudos

Look at the data binding model of the Table UI element:

The rows are taken from the list of node elements of the data source node.

Row at index i displays attributes from node element at index i.

Thus: Index of node element = row index.

Armin

Former Member
0 Kudos

Hi Damodhar

As Armin suggested, attach the attribut of type : boolean to the inputcell editor to which you want to change.

Then iterate through the node and according to the condition set the attribute according the condition.

the code might look like this.

int rows = wdContext.node<iterating node name>.size();

IPublic<ControllerName>.I<Node Name>element ele = null

IPublic<ControllerName>.I<Node Name> node = wdContext.node<iterating node>;

for(int i = 0;i<rows;i++)

{

ele = node.get<node name>elementat(i);

if(ele.getAttribute ==condition)

//set the attribute "readonly" true

}

it will be on these lines.

Can you be more specific about your problem as this can be mostly worked with supplyfunctions also

I hope it helps

Thanks

Srikant

Former Member
0 Kudos

Bind the "readOnly" property of the InputField cell editor to a context attribute under the data source node.

Set the attribute value for the node element corresponding to the row (index of node element = row index).

Armin