Sébastien,
> How do you interact with the pagination mechanism ?
If you use the cited scriptlet, you are
correct in that Jahia pagination will not be supported.
> What about a large amount of data ?
For large containerLists, this is not efficient.
This would require adding the multi-field sort feature to Jahia.
This would include adding a constructor to
org.jahia.data.containers.ContainerSorterBean to enable the declaration of a
multi-field sort, and changing the associated .doStringSort() and .
doNumberSort() methods. One might also need to define the sorting
order over each field.
If you are willing to implement this
feature, we would be more than happy to accept your contribution in Jahia. More
details are available here: http://www.jahia.org/jahia/Jahia/devzone/pid/195
Cheers
Marc
From: Sébastien
Landeau [mailto:[EMAIL PROTECTED]
Sent: 29 September 2005 11:26
To: [email protected]
Subject: Re: Multi-field sort ??
With this solution, you
walk through the whole containerList and load all keys and sort in
memory.
How do you interact with the pagination mechanism ?
What about a large amount of data ?
Regards...
2005/9/29, Philippe Vollenweider <[EMAIL PROTECTED]>:
Hello,
You can do it manually using your own key. The idea would be
something like this:
ArrayList keys = new ArrayList();
Hashtable keyToContainer = new Hashtable();
JahiaContainerList containerList =
jData.containers().getContainerList(
"containerList" );
Enumeration enumeration = containerList.getContainers();
while (enumeration.hasMoreElements()) {
JahiaContainer container = (JahiaContainer)
enumeration.nextElement();
String field1 =
container.getFieldValue("field1","", false ,
jData.params());
String field2 =
container.getFieldValue("field2","", false ,
jData.params());
String field3 =
container.getFieldValue("field3","", false ,
jData.params());
String key = field1 + field2 + field3 + "_"
+ myContainer.getID();
keyToContainer.put(myKey,myContainer);
}
Collections.sort(keys);
//Collections.sort(keys,new Comparator() {
// public int compare(Object o1, Object o2) {
// String str1 = (String) o1;
// String str2 = (String) o2;
// return str2.compareTo(str1);
// }
//});
for (int i = 0; i < keys.size(); i++) {
String key = (String) keys.get(i);
JahiaContainer container = keyToContainer(key);
//...
}
Cheers,
Philippe
At 29.09.2005 10:38, you wrote:
>Hi !
>
>I would like to know how to build multi-field sort (not a filter, a
>SORT) on a containerList.
>For example it's a need for sorting news by date, title and author (as
>AND inclusive clause).
>
>The template directoryPeople seems to change the sorter each times you
>do a selection in a combo box, so this is not a AND inlusive clause...
>Any advice ?
>
>Thank's for your help...
-------=[ pvollenweider at jahia dot com ]=---------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company