Date Picker in liferay


In Liferay it is simple to add the add the DatePicker. Liferay already had datepicker taglib, so here we go .

Creating the calendar object, for today date.

Calendar cal = CalendarFactoryUtil.getCalendar(timeZone, locale);

int startDateValue = cal.get(Calendar.DATE);
int startMonthValue = cal.get(Calendar.MONTH);
int startYearValue = cal.get(Calendar.YEAR);



Implementing the date picker,

<aui:fieldset>
<aui:field-wrapper label="start-date">
</aui:field-wrapper></aui:fieldset>

<div class="field-row">
<liferay-ui:input-date dayparam="schedulerStartDateDay" dayvalue="&lt;%=startDateValue %&gt;" disabled="&lt;%= false %&gt;" monthparam="schedulerStartDateMonth" monthvalue="&lt;%=startMonthValue%&gt;" name="startDate" yearparam="schedulerStartDateYear" yearvalue="&lt;%=startYearValue%&gt;">

</liferay-ui:input-date></div>





Here is the ouput



Following are the imports

<%@page import="com.liferay.portal.kernel.util.DateUtil"%>
<%@page import="com.liferay.portal.kernel.util.CalendarFactoryUtil"%>
<%@page import="java.util.Calendar"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

Comments

  1. Please the code is wrong, missing characters etc. :-/

    ReplyDelete
  2. Can try once again , let me know which code snippets your getting wrong ...

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate