cancel
Showing results for 
Search instead for 
Did you mean: 

Sort Images in Table

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi alex,

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

thanks,

viswa

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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