Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Enabling/Disabling Table Cells

H

I have a table with every row having a checkbox.

Based on this value of checkbox i enable/disable fields...

Can you let me know how to capture this table cell...

I wrote

int iTabSize = wdContext.nodeNodeTblAppr().size();
boolean flagApprove = true;
boolean flagReject = true;
		
IWDInputField[] validityDate = null;
IWDInputField[] comments = null;
IWDCheckBox[] chk_approve = null;
IWDCheckBox[] chk_reject = null;
		
for(int i=0;i<iTabSize;i++)
{
validityDate<i> = (IWDInputField) view.getElement("ctx_Validity_0_editor");
comments<i> 	= (IWDInputField) view.getElement("ctx_Comments_0_editor");
chk_approve<i>  = (IWDCheckBox) view.getElement("ctx_Approve_0_editor");
chk_reject<i>   = (IWDCheckBox) view.getElement("ctx_Reject_0_editor");
		
flagApprove = chk_approve<i>.getChecked();
flagReject = chk_reject<i>.getChecked();
	
if(flagApprove || flagReject)
{
validityDate<i>.setEnabled(true);
comments<i>.setEnabled(true);
}
}

Its throwing me a null pointer exception at view.getElement("ctx_Validity_0_editor");

where "ctx_Validity_0_editor" is the TableCellEditors's name...

I know i must be making a very stupid mistake...

plz let me know...

replied

Devashish,

This can be done easily through calculated attributes rather than doing it programatically in wdDoModifyView().

In the node "NodeTBlAppr", create a value attribute (VA1) of type <i>boolean</i> and bind it to the <i>checked</i> property of check box.

Then, create a calculated attribute (VA2) of type boolean under the same node and bind it to the enabled property of the inputfields "validityDate" and "comments".

Create an actionHandler for check box and bind it to the event "onToggle" of the check box.

In the generated getter of the calculated attribute write

return element.getVA1();

In the generated setter write

element.setVA2(value);

Bala

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question