2016-12-16 33 views
0

我沒有找到如何在Liferay後臺按日期排序我的文檔&網頁內容。我想我必須修改一個特殊的JSP鉤...按日期排列Liferay 6.2中的文檔和媒體和網頁內容

我希望默認排序。當用戶轉到文檔和媒體時,我期望文檔按日期默認排序(無需點擊按鈕排序)。

任何想法?

+0

存在sortBy displayDate和modifyDate排序爲webcontents和CREATEDATE modifyDate的文檔。 –

+0

是的。我忘了說我希望默認排序。 當用戶轉到文檔和媒體時,我預計文檔按日期默認排序(無需點擊按鈕排序) – DyM

回答

1

,如果你看到JSP

/html/portlet/document_library/view-entries.jsp 

對矯正此的代碼,你可以掛鉤此JSP爲Web內容

/html/portlet/journal/view-entries.jsp 

對矯正這個代碼

if (Validator.isNull(orderByCol)) { 
    orderByCol = portalPreferences.getValue(PortletKeys.JOURNAL, "order-by-col", "modified-date"); 
    orderByType = portalPreferences.getValue(PortletKeys.JOURNAL, "order-by-type", "asc"); 
} 

orderByComparator = JournalUtil.getArticleOrderByComparator(orderByCol, orderByType); 

對於文件代碼

if (Validator.isNull(orderByCol)) { 
    orderByCol = portalPreferences.getValue(PortletKeys.DOCUMENT_LIBRARY, "order-by-col", StringPool.BLANK); 
    orderByType = portalPreferences.getValue(PortletKeys.DOCUMENT_LIBRARY, "order-by-type", "asc"); 
} 

在兩個JSP中的默認值,只是更改爲需要在後臺辦公

+0

我已經做了此更改但沒有任何發生。 – DyM

+0

它幾乎不錯。一個以下的問題: 爲什麼這行「orderByType = portalPreferences.getValue(PortletKeys.JOURNAL,」order-by-type「,」desc「);」 make orderByType =「asc」 – DyM

+0

因爲如果有值,我們試着從偏好中獲得它,否則使用默認的「desc」。我在這種情況下的首選項是asc –

相關問題