SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sort LI elements

    HI,

    i generate with DWR dynamically a list at the DOM, the problem is, that this list is not sorted. Is there a possiblility to sort after generating the list with javascript?

    Thanks

    Thorsten

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple store the content of each (assuming its text) LI + the node itself in an Array. Then use the Array's sort method to sort. Since the nodes are stores in the Array as well they are also sorted, and you can simply use appendChild to re-arrange the list.

  3. #3
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pepe,

    thanks for the information.

    Regards Thorsten


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •