cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox in table not getting diabled

Former Member
0 Kudos

Hi,

I created a table and added a checkbox grouped column.

I am using the following code to disable the checkboxes.

IWDCheckBox iwdcb;

IWDTable iwdtbl;

iwdtbl = (IWDTable)view.getElement("tbl");

iwdcb = (IWDCheckBox)iwdtbl.getGroupedColumn(3);

iwdcb.setEnabled(false);

It is throwing a Null Pointer.

Any suggestions.

Regards

Asif

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Asif,

Try using the following code for setting the enabled property for the check box column.


for(int i =0; i< wdContext.node<NodeX>.size();i++)
{
   wdContext.node<NodeX>.get<NodeX>ElementAt(i).set<AttributeX>(false);
}

Bala

Answers (2)

Answers (2)

Former Member
0 Kudos

HI Asif,

It seems that the context variables are not initialized properly. Please check whther during initialization of the app/view you are creating proper objects and binding them to the context nodes or not, like following,

Request_SendEmailPortType_sendEmail req =

new Request_SendEmailPortType_sendEmail();

wdContext.nodeWebServiceEmail().bind(req);

Best regards,

Guru.

Former Member
0 Kudos

How can you see that from the posted code?

Armin

Former Member
0 Kudos

First: This code contains several errors.

I guess you get a NPE because there is no view element with ID "tbl" (otherwise you would get a ClassCastException in the next line or because there is no grouped column at index 3 (and the ClassCastException does not occur, but the next line fails).

Second: You shouldn't write code inside wdDoModifyView() to change UI element properties, but rather use data binding.

Create a boolean context attribute "Enabled" under the data source node, say "Rows", of the table, bind the "enabled" property of the checkbox to that attribute.

To disable checkbox in i'th row, set the attribute value of the node element at index i:

wdContext.nodeRows().getRowsElementAt(i).setEnabled(false);

Armin