Sorting XML data linked to a drop-down list

Dave_Erho

07-04-2015


I am looking for a javascript code that I can use to sort XML data linked to a drop-down list when the list is accessed by mouse-down. For reasons that I can't get into here, I cannot sort the xml before loading it into the form.

I am using LiveCycle Designer ES 8.2.1

Accepted Solutions (0)

Answers (5)

Answers (5)

Magus069

MVP

07-04-2015

Hi there,

Good method to sort XML with XSLT!

As I would have suggested you to have a second dropdownlist to be the displayed data view,

If you rather use another method than XSLT, you could try retrieving each data inside the dropdownlist and create an Array out of it.

With the array you can use the method sort(); and once sorted out, you only need to insert them in the displayed dropdownlist data view.

Hope you will manage to make this work!

Dave_Erho

07-04-2015

My data is coming from an excel spreadsheet that is updated about once a month. I am creating an XML file from that data and then importing into my pdf. I haven't tried using an XSLT stylesheet to transform it. I'm not familiar with them, so I will have to look into it.

This is the first time that I have pulled in outside data, so I'm trying to learn quickly.

Dave_Erho

07-04-2015

I clicked on "List Items" in the Object/Cell tab and made a data connection to an XML file. There are about 600 items in the data source, so I didn't want to type them all in.


Magus069

MVP

07-04-2015

Hi Dave,

I would to know, how do you set the data items in the dropdownlist?

Is it from a database or is it set manually with JavaScript?

If you set it with JavaScript how do you manage to insert the data items in the dropdownlist?