on 11-13-2006 4:10 AM
Hi,
I have created a node called cauverynode, which contains cauName and cauClient as its attribute. I have bound that node with the table. Now i have to store the selected clients into a context. How can i do that? Please help me out. i am unable to store the clients in a string context. Kindly solve it. Below is the code, which will store the selected item and put into a string variable.
public void supplyCauveryNode(IPrivateSampleComponent.ICauveryNodeNode node, IPrivateSampleComponent.IContextElement parentElement)
{
//@@begin supplyCauveryNode(IWDNode,IWDNodeElement)
IPublicSampleComponent.ICauveryNodeNode cauNode =
wdContext.nodeCauveryNode();
ArrayList selectedcauClients = new ArrayList(cauNode.size());
for (int i = 0, n = cauNode.size(); i < n; ++i) {
if (cauNode.isMultiSelected(i) || i == cauNode.getLeadSelection())
{
selectedcauClients.add(cauNode.getElementAt(i));
}
}
String strSelcaucli = null;
for (int i = 0, n = selectedcauClients.size(); i < n; i++) {
strSelcaucli = strSelcaucli + selectedcauClients.get(i);
}
wdContext.currentContextElement().setStrCauveryClient(strSelcaucli);
//@@end
}
Multiple selected data is been stored in this selectedcauClients arraylist, which is not working. Kindly help me out.
Thanks & Regards,
Dhana
What is the following code supposed to do?
String strSelcaucli = null;
for (int ix = 0, n = selectedcauClients.size(); ix < n; ix++) {
strSelcaucli = strSelcaucli + selectedcauClients.get(ix);
}
wdContext.currentContextElement().setStrCauveryClient(strSelcaucli);
I guess you want to create a string containing the names(?) of all selected elements.
Then you should use something like
StringBuffer sb = new StringBuffer();
for (Iterator it = selectedcauClients.iterator(); it.hasNext(); )
{
ICauveryNodeElement e = (ICauveryNodeElement) it.next();
sb.append(e.getName());
if ( it.hasNext() ) sb.append(",");
}
String csv = sb.toString();
This gives you a comma-separated list of the names of the selected elements.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u so much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dhana,
Create a Button on the form and write the following code on Click action of the button.
Press the button after selecting the data in the table.
ArrayList selectedcauClients = new ArrayList(cauNode.size());
for (int i = 0, n = cauNode.size(); i < n; ++i) {
if (cauNode.isMultiSelected(i))
{
selectedcauClients.add(cauNode.getElementAt(i));
}
}
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.