Re: Image Sort Order

  •  01-24-2011, 3:44 PM

    Re: Image Sort Order

    Can you show me an example of how I would sort by categoryid? In the XML file I put a number in categoryid. I replace time below with categoryid but it doesnt seem to be working...
     
      function BubbleSort(arr)
     {
            var temp;
            var exchange;
            for(var i=0; i<arr.length; i++)
            {
                exchange = false;
                for(var j=arr.length-2; j>=i; j--)
                {
                    if(GalleryFormatTimeHTML(arr[j+1].categoryid) <GalleryFormatTimeHTML(arr[j].categoryid))
                    {
                        temp = arr[j+1];
                        arr[j+1] = arr[j];
                        arr[j] = temp;
                        exchange = true;
                    }
                }
                if(!exchange) break;
            }
            return arr;
         }
        photos=BubbleSort(photos);
     
View Complete Thread