2 Replies Latest reply on Jun 18, 2008 12:43 PM by WolfShade

    Sort order question

    WolfShade Level 4
      Hello, all.

      I have a client who would like to have the ability to change the order in which sub navigation items appear on their site.

      I've got it to the point where if the SO is changed in the database, that change is reflected on the site. But currently the change has to be manually done via Enterprise Manager.

      The next step is to set up the CMS so that the SO can be changed. I'm looking into a javascript solution that displays all items in a select object (size=number of records in recordset) and the items can be "dragged" to whatever position in the list the user wants.

      My ideas end, there. Any suggestions on how to pass that information to the database for the update? Should I use an array? Where do you recommend I go, from here?


        • 1. Re: Sort order question
          Dan Bracuk Level 5
          You didn't mention how the user calls the page to start with. If you are using a form, you can have "sort by" form fields and process them accordingly.

          To change the sort order after the page has been loaded, you don't have to pass anything back to the database. You can change the display using js. One of my co-workers wrote a page where you can sort data in an html table by clicking on the column header.

          • 2. Sort order question
            WolfShade Level 4
            This is for a CMS, the part that allows an admin to change the sort order of sub-navigation items associated with a particular top-navigation item on the pages that the public can access. (The sub-navigation items are articles.)

            Currently, the idea is that each top navigation item uses js to display all sub-nav items associated with that top-nav, and at the top of the list of sub-nav items is a link for changing the SO of those sub-nav items. When the top-nav clicked is for, say, "About", then all sub-nav items (clickable for editing) under the heading of "About" appear with a link at the top of the list that says "Change Sort Order for: About"; when clicked this will open a page that (ideally, if I can find the js for it) contains a select box that has a size equal to the number of sub-nav items so there is no scrollbar, and contains all sub-nav items in the current sort order from top to bottom; the js allows the user to click-n-drag the items to the order they want them in, then click a submit button to make the changes in the database. Each sub-nav item in the database has a sortOrder column, datatype int; this is the column that needs updating. I'm just not sure how to make sure that the ID associated with each sub-nav item gets the correct value in the sortOrder column.

            So it will be more than just "click this header to sort data according to this column" (which I'd use CF for that, not js). The client wants a customisable sort order for the sub-nav items (first item = 1, second item = 2, etc.; change the way the items appear on the public side pages.)