cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox issue(how to set select/true or deselect/false )

Former Member
0 Kudos

Hi Experts,

I have 5 checkboxes in one view which are all selected by default.All the code are dynamic code and all teh UI elements are dynamic.Now I want to deselect the first checkbox and click OK (one action button in that view).Now when I open that page (which contain the same 5 checkbox),I should get the first checkbox deselected.

Meand I want to set the visible property as false when I click apply,so that when I open the view again,i will get the first checkbox as deselected.

Please suggest me how to the value of the dynamic checkbox(true/false) the moment I select or de-select .

Please suggest.

Regards

-Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Sandeep,

If I understood your question correctly,create 5 value attributes of type boolean and bind the checkbox with these attributes.when you click on apply button,change the value of context attribute.

Hope this helps

Regards,

Naidu

Former Member
0 Kudos

HI,

My problem is how to set the onSetToggle() action in the checkbox.?Once I get the values for the checkbox,I can use that infor mation in the wdDoModifyView()

Please suggest

former_member751941
Active Contributor
0 Kudos

Hi Sandip,

Check this thread.

Regards,

Mithu

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

You can resolve this problem by execuing follow code:-

if(wdContext.node<Node_Name>().isMultiSelected(i))

{

wdComponentAPI.getMessageManager().reportSuccess("selected "+

wdContext.node<Node_Name>().get<Node_Name>ElementAt(i).getAttributeValue(<Attribute_Value>));

}

Thanks and Regards

Kiran Namdeo Patil

Former Member
0 Kudos

Can you please explain the use case? Why do you need to create check boxes by code? Why can't you use a CheckBoxGroup?

Armin

Former Member
0 Kudos

HI Armin,

I have total 35 number of checkbox.Depending upon the user 's selection(select/de-select),I have to retain the state of the checkbox.If I can get which perticular checkbox the user has modified and to which state(true/false),I can update the node attribute(by setting the node attribute for the checkboxes).

Former Member
0 Kudos

I want to put setOnToggle() action for the checkbox so that I will be able to know what was the previous value and what is the new value of the check box nad which perticular checkbox has been modified.

Former Member
0 Kudos

HI Experts,

Please help me on this.

-Sandip

Former Member
0 Kudos

That's not what I meant by "explain the use-case". But nevertheless...

When using individual check-boxes, you need one boolean context attribute per check-box to store the "checked" state. These attributes can either be created at design-time (preferred) or by code.

If the check-boxes can be placed in a common area of the view, you should use a CheckBoxGroup. In that case you don't need one context attribute per check-box, but one context node with an attribute that provides the text for each check box. The "checked" state is provided by the context node's multi-selection in that case.

In each case you can use one common action to handle selection change events.

If needed, you can also identify the check box that has been checked/unchecked inside the action handler. When using individual check boxes, this can be done using parameter mapping, for CheckBoxGroups there exists a predefined event parameter named "index" that contains the zero-based index of the check box in the group.

Creating check-boxes and their context attributes by code should only be done if really needed. That's why I wanted to know your use-case.

Armin

srinivas_sistu
Active Contributor
0 Kudos

Hi Sandip,

//inside doModify

IWDAttributeInfo info;

for(your loop condition)

{

try {

IWDCheckBox check =(IWDCheckBox) view.createElement(IWDCheckBox.class,"Check" + count);

IWDGridData checkHeadData =(IWDGridData) check.createLayoutData(IWDGridData.class);

info =wdContext.nodeCheckNode().getNodeInfo().getAttribute("Checkattribute" + count);

check.bindChecked(info);

check.setEnabled(true);

check.setChecked(false);

checkHeadData.setWidth("4%");

}

catch()

{

}

}

//end of domodify

//inside any method where u want to access the checked property of checkbox

for (ur for loop condition)

{

Boolean check =(Boolean) wdContext.nodeCheckNode().currentCheckNodeElement()

.getAttributeValue(

"Checkattribute" + count);

}

now ur above check(Boolean) will carry the checkbox(at "Checkattribute" + count) state. i.e, it is checked or unchecked....

Hope it will be helpful for u.....

Regards,

Srini.