on 07-07-2009 7:49 PM
Hi,
I want to have a checkbox in one of the column in the table. When this checkbox is selected, then I need to pass this value is selected to the backend. How can we do this?
How we can have some action when the checkbox is selected?
Regards
MQ
Hi,
You need to follow these steps to get the checked value on submit and pass it to the backend :
1. create one value attribute (let us suppose name is flag) of type boolean in the node to which the table is bound.
2. In the table, now add the checkbox UI element and bind the flag to that "checked" property of check box UI element.
3. Now create one Action onSelectAction
4. Add this action to the "onSelectAction" porperty of check-box.
5. Create another node to add the selected data to the node.
In onSelectAction write the code to read the checkbox value.
Now in the code you can get the selected rows by user as below:
for(int i=0;i<TableNode().size();i++)
{
boolean isSelected = wdContext.current<table_node>.getTableNodeElemntAt(i).Element.getFlag();
if(isSelected)
{
IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
wdContext.nodeResultNode().addElement(element);
}
}
Hope this solution helps you.
Thanks
Ritushree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer this code,
Create a boolean attribute select in the table node and bind it to checked property of the check box.
for(int i=0;i<wdContext.node<tablenode>()..size();i++)
{
if(wdContext.node<tablenode>().get<tablenode>ElementAt(i).select())
wdContext.node<tablenode>().get<tablenode>ElementAt(i).set<yourattribute>("X");
else
wdContext.node<tablenode>().get<tablenode>ElementAt(i).set<yourattribute>(" " ");
}
Regards,
Sunaina Reddy t
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the Node which you binded to the table create one more attribute of type boolean.
For example your node is as below:
//Table Node
TableNode
-
> Att1
-
> Att2
-
> isSelected(boolean) - Newly created attribute for this requirement.
//Result Node contains the elements selected in TableNode
ResultNode
-
>Att1
-
>Att2
Now in the table create one more Column with Checkbox as tablecell editor.
Now bind this "isSelected" boolean attribute to that "checked" property of check box UI element.
Now in the code you can get the selected rows by user as below:
for(int i=0;i<TableNode().size();i++)
{
if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
{
IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
wdContext.nodeResultNode().addElement(element);
}
}
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Lets assume that your table node of this structure
Table -- Node
|
|-- Check -- Value attribute of type 'boolean'.
Now you have a button on click which you want to save the selected rows. The selected rows now will contain the value of attribute 'Check' as 'true'.
OnClick - Event handler
wdContext.nodeTable().moveFirst();
for (int i=0;i<wdcontext.nodeTable().size();i++)
{
if(wdcontext.currentTableElement().getCheck()
{
//Save your data to backend
}
wdContext.nodeTable.moveNext();
}
Best Wishes
Idhaya R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To add a check box in your table follow these steps:
1. create one value attribute (let us suppose name is BooleanVal) of type boolean in the node, which you bind to the table.
2. In the table, expand the BooleanVal column and delete the TextView element from that. Add the checkbox UI element and bind the BooleanVal to
3. Now create one Action onToggleBooleanValAction.
4. Add this action to the "onToggle" porperty of check-box.
In onToggleBooleanValAction write the code to read the checkbox value.
boolean isSelected = wdContext.current<table_node>Element.getBooleanVal();
Hope this helps!
Regards,
Jaya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In check box you have onToogle Action.
You can call an action Handler of this Action to execute some logic in backend.
Regards
Marcos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.