cancel
Showing results for 
Search instead for 
Did you mean: 

Working with Table Check Box's

Former Member
0 Kudos

Hi Guru's

I want to implement following scenario

1-->in a table i have two columns with check boxes and N no of rows, these should be enabled depends on the web service.

2 --> and i have to implement "Select/Deselect all" check boxes for this

3 --> and i can able to select/deselect check boxes as i want in a table

4--> when i click on save button all the checked data should be stored in a data base as a flag.

So would you please help me in this scenario how do i need to capture the checkbox value in a table?

Thanks in advance

Anu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

s

Former Member
0 Kudos

Hi,

Your Question,

1-->in a table i have two columns with check boxes and N no of rows, these should be enabled depends on the web service.

Answer,

Add CheckBox UI element to the column of the table and bind its Checked property to an attribute of type boolean, added in the table node. While populating this node with the data from web service set this boolean attribute with true or false as needed.

Your Question,

2 --> and i have to implement "Select/Deselect all" check boxes for this

3 --> and i can able to select/deselect check boxes as i want in a table

Answer,

Remove the Header UI from each column of the table. Add a FixedTopCell to each column as follows. In the context menu of each column select Insert --> FixedTopCell --> TableStandardCell.

Add a CheckBox UI to this FixedTopCell, in the columns having checkbox and add a Textview UI for the remaining columns. Create a context attribute say Va_CheckUnCheckAll, of type boolean and bind it to Checked property of the checkbox added in the fixedtopcell and also create an actionhandler and bind it to OnToggle event of this checkbox. In this action handler, if the value of the attribute Va_CheckUnCheckAll is true then loop through the table node and set boolean attribute in the table node bound to that column as true, else if the value of the attribute Va_CheckUnCheckAll is false set the boolean attribute in the table node to false.

Your Question,

4--> when i click on save button all the checked data should be stored in a data base as a flag.

Answer,

Loop thourgh the table node and based on whether the boolean attriubte in the table node bound to the checkbox UI, is true or false, set the flag appropriatly.

Regards,

Vishweshwara P.K.M.

Former Member
0 Kudos

HI Vishveshwar,

Thank you for your reply, i done what you mentioned but i got a problem in table check box selection,

i have 20 rows in a table if i check the check box in first row the data is updating because it is leadselected bydefault, if i check the checkbox in some other row with out lead selecting the row data is not updating that means the event of this checkbox is not calling with out lead selecting

so is there any way i can do it with out lead selecting the table row to get the values by checking/unchecking the check box

Please help me in this issue

thanks

Anu

Former Member
0 Kudos

Hi Anusha,

I guess, you have missed out something. If you had followed my earlier replay, you should not have faced this problem, as there is no event bound to the check box added in the table column and lead selection has no role to play in this approch. As explained earlier the check box should be bound to an attribute of type boolean created under the table node. So if the table has 20 rows, then there will be 20 elements in the table node and in each element, the instance of the boolean attribute will be true if selected else will be false. So as mentioned in 4th point in my previous replay, check for the value in that variable by looping through the table node and you should be able to resolve the problem. Below is the example assuming Va_CheckBoxValue is the name of boolean attribute.


int noOfRows = wdContext.node<TableNode>.size();
IPrivate<ViewName>.I<TableNodeElement> element = null;
for (int loopIndex = 0; loopIndex < noOfRows; loopIndex++) {
element = wdContext.node<TableNode>().<TableNodeElement>At(loopIndex);
if(element.getVa_CheckBoxValue()){
//Check box is selected in this row, Update the flag of webservice.
}
else{
//check box not selected in this row
}

Revert back If still not resolved.

Regards,

Vishweshwara P.K.M.