Skip to Content
avatar image
Former Member

Sort Images in Table

Hi,

I have a coulm of images in table . and if i click on the header of that coulm , i should get it sorted..is there any way to sort images in coulmn..

Thanks in advance for a quick answer..

Regards

AD

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Dec 19, 2005 at 05:36 AM

    Hi AD,

    On what basis you want to sort the Images ?

    May be you can tableSorter utility to sort the images by filename.

    Regards,Anilkumar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 19, 2005 at 06:02 AM

    Hi,

    I tried the table sorter utility.but it is sorting only if there are text property.

    so it is sorting according to the text.

    then i tried the code

    Comparator comparator = new Comparator()

    {

    public int compare(Object x1, Object x2)

    {

    IResultNodeElement e1 = (IResultNodeElement ) x1;

    IResultNodeElement e2 = (IResultNodeElement ) x2;

    return e1.getDs().compareTo(e2.getDs());

    }

    };

    wdContext.nodeResultNode().sortElements(comparator);

    Then it is sorting in one order..is there any way to sort it in other order..

    Regards

    AD

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Alex,

      Just use other attribute for sorting. The only requirement is that attribute type implements comparable interface. This is true for majority of built-in WD simple types (time, date, all numeric, string)

      So the last line should be like

      e1.getLastModified.compareTo( e2.getLastModified() );

      Also for some attributes do not forget to check nulls, i.e.

      if ( e1.getLastModified() == null ) 
        return e2.getLastModified() == null ? 0 : -1;
      e1.getLastModified.compareTo( e2.getLastModified() );

      VS

  • avatar image
    Former Member
    Jun 25, 2009 at 06:42 AM

    Hi alex,

    Can you explain me how you stored the images in to the table...

    thanks,

    viswa

    Add comment
    10|10000 characters needed characters exceeded