Fórum
Order Document Library files
Paul Masterson, modificado 13 Anos atrás.
Order Document Library files
New Member Postagens: 16 Data de Entrada: 12/10/09 Postagens Recentes
Hi
Is it possible to order the 'Document Library' files by date.
I am sure it is some config file, but it's Friday and at this stage I am half blind
Is it possible to order the 'Document Library' files by date.
I am sure it is some config file, but it's Friday and at this stage I am half blind
Paul Masterson, modificado 13 Anos atrás.
RE: Order Document Library files
New Member Postagens: 16 Data de Entrada: 12/10/09 Postagens Recentes
Any takers for this one?
Oliver Bayer, modificado 13 Anos atrás.
RE: Order Document Library files
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Paul,
afaik it's only possible if you write an own comparator and modify jsps. But if you've found a better solution let me know.
Greets Oli
afaik it's only possible if you write an own comparator and modify jsps. But if you've found a better solution let me know.
Greets Oli
Paul Masterson, modificado 13 Anos atrás.
RE: Order Document Library files
New Member Postagens: 16 Data de Entrada: 12/10/09 Postagens Recentes
Thank you I appreciate your reply
Would you know what jsp's to modify?
Thanks
Paul
Would you know what jsp's to modify?
Thanks
Paul
Oliver Bayer, modificado 13 Anos atrás.
RE: Order Document Library files (Resposta)
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi,
I don't find a solution till now but maybe you can use my hints to get it working.
1) In the view.jsp of the document library portlet (path: /html/portlet/document_library/) you will found around line 180 the search container which shows the files of a folder.
2) If you want to add a new column like e.g. date you have to possibilities. You can modify the portlet-custom.xml and add the following to the preferences of the document library display portlet:
or you can add the following line to the init-ext.jsp of the document library:
Now you see a new header of the result table but no output.
3) To get the date output you have to modify the file_entry_columns.jspf and add a new c:when block.
Now you should see the date of each file entry of the result table.
The sorting can maybe done via Collections.sort(result, your-comparator-to-write). Or you can use the "FileEntryModifiedDateComparator".
HTH Oli
I don't find a solution till now but maybe you can use my hints to get it working.
1) In the view.jsp of the document library portlet (path: /html/portlet/document_library/) you will found around line 180 the search container which shows the files of a folder.
2) If you want to add a new column like e.g. date you have to possibilities. You can modify the portlet-custom.xml and add the following to the preferences of the document library display portlet:
<preference>
<name>fileEntryColumns</name>
<value>name,size,date</value>
</preference>
or you can add the following line to the init-ext.jsp of the document library:
String[] fileEntryColumns = StringUtil.split("name,size,date,action");
Now you see a new header of the result table but no output.
3) To get the date output you have to modify the file_entry_columns.jspf and add a new c:when block.
<c:when test="<%= fileEntryColumn.equals("date") %>">
<liferay-ui:search-container-column-text href="<%= rowHREF %>" name="<%= fileEntryColumn %>" value="<%= String.valueOf(fileEntry.getCreateDate()) %>" />
</c:when>
Now you should see the date of each file entry of the result table.
The sorting can maybe done via Collections.sort(result, your-comparator-to-write). Or you can use the "FileEntryModifiedDateComparator".
HTH Oli
Paul Masterson, modificado 13 Anos atrás.
RE: Order Document Library files
New Member Postagens: 16 Data de Entrada: 12/10/09 Postagens Recentes
Ollie
Brillant, that works perfectly
What I did was add the date to the existing string and then added the C block as suggested
Thank you
Paul
Brillant, that works perfectly
What I did was add the date to the existing string and then added the C block as suggested
Thank you
Paul
Wafa Bouyahi, modificado 10 Anos atrás.
RE: Order Document Library files
New Member Postagens: 5 Data de Entrada: 03/05/13 Postagens Recentes
I followed the same steps in order to reorder the documents by creation date but nothing happened
I'm using liferay 6.0.5 . Any suggestions please
I'm using liferay 6.0.5 . Any suggestions please
Oliver Bayer, modificado 10 Anos atrás.
RE: Order Document Library files
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Wafa,
what do you mean by "nothing happened"? Do you get any exceptions/ error messages on the tomcat console? Maybe some methods changed in v6.0.5. You should give more info so we can -maybe/ hopefully - help.
Greets Oli
what do you mean by "nothing happened"? Do you get any exceptions/ error messages on the tomcat console? Maybe some methods changed in v6.0.5. You should give more info so we can -maybe/ hopefully - help.
Greets Oli
Wafa Bouyahi, modificado 10 Anos atrás.
RE: Order Document Library files
New Member Postagens: 5 Data de Entrada: 03/05/13 Postagens Recentes
Thanks for your reply ;)
In fact nothing happened because in document display i have just the name of the folder or the file so i can't see the added column "date".
But i just want that the default order of the files and the folders to be by creation date.
I didn't know how to apply the sorting here :
<liferay-ui:search-container-results
results="<%= DLFolderServiceUtil.getFolders(scopeGroupId, folderId, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%= foldersCount %>"
/>
Thanks in advance
In fact nothing happened because in document display i have just the name of the folder or the file so i can't see the added column "date".
But i just want that the default order of the files and the folders to be by creation date.
I didn't know how to apply the sorting here :
<liferay-ui:search-container-results
results="<%= DLFolderServiceUtil.getFolders(scopeGroupId, folderId, searchContainer.getStart(), searchContainer.getEnd()) %>"
total="<%= foldersCount %>"
/>
Thanks in advance
Wafa Bouyahi, modificado 10 Anos atrás.
RE: Order Document Library files
New Member Postagens: 5 Data de Entrada: 03/05/13 Postagens Recentes
Any suggestions please
Ricardo Vieira, modificado 10 Anos atrás.
RE: Order Document Library files
Junior Member Postagens: 54 Data de Entrada: 16/08/10 Postagens Recentes
Does anyone have a suggestion on how to do this, I've managed to get the creation date in the dl display, but cant figure out where to do the sort by date
any help would be greatly appreciated
tnx
any help would be greatly appreciated
tnx
Oliver Bayer, modificado 10 Anos atrás.
RE: Order Document Library files
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Wafa, hi Racardo,
I don't have ported my sugguestions to v6.1 (v6.2) yet so I can give you only some hints on how you can maybe implement it. If you take a look at "view_entries.jsp" around line 116 you'll see an OrderByComparator object. Maybe it's sufficient if you add the newly added column to the orderableHeaders list. This would be the easiest solution but you can still write a custom comparator class (as described in one of my answers above) and use Collections.sort(results, YourComparator) before calling searchContainer.setResults(results) at line 244.
HTH Oli
I don't have ported my sugguestions to v6.1 (v6.2) yet so I can give you only some hints on how you can maybe implement it. If you take a look at "view_entries.jsp" around line 116 you'll see an OrderByComparator object. Maybe it's sufficient if you add the newly added column to the orderableHeaders list. This would be the easiest solution but you can still write a custom comparator class (as described in one of my answers above) and use Collections.sort(results, YourComparator) before calling searchContainer.setResults(results) at line 244.
HTH Oli
Ricardo Vieira, modificado 10 Anos atrás.
RE: Order Document Library files
Junior Member Postagens: 54 Data de Entrada: 16/08/10 Postagens Recentes
Thanks Oliver, you set me on the right track
My client has the 6.0.6 version, so I didnt find the "view_entries.jsp" and no OrderByComparator object but found the "view_file_entries.jspf" so what I did was setting the Collections.sort before setting the attribute "results" it worked, i need to refine the comparator but heres my first test if anyone needs it and works:
tnx again
My client has the 6.0.6 version, so I didnt find the "view_entries.jsp" and no OrderByComparator object but found the "view_file_entries.jspf" so what I did was setting the Collections.sort before setting the attribute "results" it worked, i need to refine the comparator but heres my first test if anyone needs it and works:
Collections.sort(results, new Comparator<dlfileentry>() {
public int compare(DLFileEntry m1, DLFileEntry m2) {
return m1.getCreateDate().compareTo(m2.getCreateDate());
}
});</dlfileentry>
tnx again
Oliver Bayer, modificado 10 Anos atrás.
RE: Order Document Library files
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Ricardo,
no problem, I'm glad I could help .
The jsps changed quite a bit from 5.2.3 to 6.1 and again for 6.2 that's why I could give only hints. But the possible solutions are still similar and writing a custom comparator should always work. Thanks for posting your solution - it could be helpful for others.
Regards Oli
no problem, I'm glad I could help .
The jsps changed quite a bit from 5.2.3 to 6.1 and again for 6.2 that's why I could give only hints. But the possible solutions are still similar and writing a custom comparator should always work. Thanks for posting your solution - it could be helpful for others.
Regards Oli
Alessandro Lachina, modificado 8 Anos atrás.
RE: Order Document Library files
New Member Postagens: 24 Data de Entrada: 12/06/13 Postagens Recentes
So what do you think we need to do to order on date in 6.2?
Any hints will be appreciated.
Thanks
Any hints will be appreciated.
Thanks