on 04-23-2009 5:26 AM
Hi,
I've manage to manually added list of values using svs in a for loop into a dropdown. Is there a way the list in the dropdown display in a sorted way?
Thanks
Edited by: Shreya Eknath on Apr 23, 2009 12:38 PM
Hi,
from where ur adding values to the dropdown?
while adding the values perform sorting and then add .
Regards,
Ramani.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramani,
Below are the codes on how I added the values to the dropdown. Please advice how to get the list display sorted alphabetically.
* IPrivateBsb.IBttlNode bttlNd =*
* wdContext.nodeBttl();*
* IWDAttributeInfo bttlList =*
* wdContext.getNodeInfo().getAttribute("BttlDrop");*
* ISimpleTypeModifiable bttlType =*
* bttlList.getModifiableSimpleType();*
* IModifiableSimpleValueSet valueSetBttl =*
* bttlType*
* .getSVServices()*
* .getModifiableSimpleValueSet();*
* for (int count = 0; count < bttlNd.size(); count++) {*
* IPrivateBsb.IBttlElement bttlEmt =*
* bttlNd.getBttllementAt(count);*
* valueSetBttl.put(*
* bttlEmt.getBttlId()*
* bttlEmt.getBttlName());*
* }*
Hi,
Try this code:
IPrivateBsb.IBttlNode bttlNd =wdContext.nodeBttl();
IWDAttributeInfo bttlList =wdContext.getNodeInfo().getAttribute("BttlDrop");
ISimpleTypeModifiable bttlType = bttlList.getModifiableSimpleType();
IModifiableSimpleValueSet valueSetBttl =bttlType.getSVServices().getModifiableSimpleValueSet();
List tempList = new ArrayList();
for (int count = 0; count < bttlNd.size(); count++) {
IPrivateBsb.IBttlElement bttlEmt = bttlNd.getBttllementAt(count);
tempList.add(bttlEmt.getBttlName());
}
Collections.sort(tempList);
// Also check these ways.....
// Case-insensitive sort
// Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
// Reverse-order sort
// Collections.sort(list, Collections.reverseOrder());
int size = tempList.size();
String name = null;
for (int i = 0; i < size; i++) {
name = (String)tempList.get(i);
IPrivateBsb.IBttlElement bttlEmt = bttlNd.getBttllementAt(count);
if(name.equalsIgnoreCase(bttlEmt.getBttlName())){
valueSetBttl.put(bttlEmt.getBttlId(), name);
}
I hope this helps.. Please revert back in case u want further help.
Thanks and Regards
Pravesh
Hi,
first get that node values in List.and then sort and add that List back to that node.
List list = new ArrayList();
for(int i=0;i<wdContext.nodeNew().size();i++)
{
String s=wdContext.nodeNew().getNewElementAt(i).getAttr();
list.add(i,s);
}
Collections.sort(list);
IPrivateFirstapplicationView.INewElement ele;
for(int i=0;i<list.size();i++)
{
ele=wdContext.createNewElement();
ele.setAttr(list.get(i).toString());
wdContext.nodeNew().addElement(ele);
}
and add these node values to ur dropdown.hope this will work fine please let me knw if there r any issues.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.