cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

XUI sorted listbox

ebheadrick
1-Newbie

XUI sorted listbox

Hi all,

I was building a listbox that I used the sort=true. The listbox is sorted fine, BUT when you select an item in the listbox to use it doesn't pass back the correct item. One of my experiments I selected the item and then displayed information in the next listbox. When the listbox was sorted and I picked the 6th item it returned the information of the 6th item of the non-sorted listbox.

Has anyone seen this before? Do other people use the sort attribute? I didn't see anything in the archives.

Thanks,
Ellen

Arbortext 5.2M020 is being used and Javascript is being called from the dailog box.

3 REPLIES 3

Hey, Ellen...

Can you post some of your code for this? Specifically, I'm curious
about how you're getting the selected value from the listbox, as I
seem to recall that there are a couple of ways.

-Brandon 🙂

Brandon Ibach
Developer, Single-Sourcing Solutions, Inc.

On Tue, Aug 25, 2009 at 3:00 PM, Ellen
Headrick<ellen.headrick@jeppesen.com> wrote:
> Hi all,
>
> I was building a listbox that I used the sort=true. The listbox is sorted
> fine, BUT when you select an item in the listbox to use it doesn't pass back
> the correct item. One of my experiments I selected the item and then
> displayed information in the next listbox. When the listbox was sorted and
> I picked the 6th item it returned the information of the 6th item of the
> non-sorted listbox.
>
> Has anyone seen this before? Do other people use the sort attribute? I
> didn't see anything in the archives.
>
> Thanks,
> Ellen
>
> Arbortext 5.2M020 is being used and Javascript is being called from the
> dailog box.
>
> -----End Original Message-----
>

/* ********************************************************************
* Function for getting the selected items in a Combo Box
* ********************************************************************
*/
function selectedItems(list)
{
var listboxElem = dialogDoc.getElementById(list +"ComboBox").getElementsByAttribute("selected","true", 1);

var selectedListItemsID = [];
var i; /* local index vars */

for (i=0; i < listboxElem.length; i++)
{
selectedListItemsID[i] = listboxElem.item(i).getAttribute("id");
}
return selectedListItemsID;
}

So the returned array should have the list of ids selected. Then I use it like below, the ids are unique so I can use them as keys to get other data.

var selectedFIR = selectedItems("FIR");
var idProvince = selectedFIR[i].slice(2);
metaProvinceNode = activeDoc.getElementsByAttribute("value", idProvince, 1);

Hey, Ellen...

There's a fair bit of slicing and dicing of data going on, here.  Can
you produce a simplified, standalone test case that demonstrates the
problem you're having, avoiding any dependencies on other parts of
your application?  If the process of producing this doesn't help you
resolve the problem, it will certainly make it much easier for
somebody here to help you.

-Brandon 🙂

On Wed, Aug 26, 2009 at 5:39 PM, Ellen
Headrick<ellen.headrick@jeppesen.com> wrote:
>  /* ********************************************************************
>  * Function for getting the selected items in a Combo Box
>  * ********************************************************************
>  */
>  function selectedItems(list)
>  {
>  var listboxElem = dialogDoc.getElementById(list
> +"ComboBox").getElementsByAttribute("selected","true", 1);
>
>  var selectedListItemsID = [];
>  var i; /* local index vars */
>
>  for (i=0; i < listboxElem.length; i++)
>  {
>  selectedListItemsID[i] =
> listboxElem.item(i).getAttribute("id");
>  }
>  return selectedListItemsID;
>  }
>
> So the returned array should have the list of ids selected. Then I use it
> like below, the ids are unique so I can use them as keys to get other data.
>
> var selectedFIR = selectedItems("FIR");
> var idProvince = selectedFIR[i].slice(2);
> metaProvinceNode = activeDoc.getElementsByAttribute("value", idProvince, 1);
>
>
> ----------
>
Top Tags