留言板

LIferay, AUI datepicker is not working

thumbnail
Chandan Sharma,修改在9 年前。

LIferay, AUI datepicker is not working

Junior Member 帖子: 54 加入日期: 14-3-4 最近的帖子
Hi Experts,

I am trying to use Liferay/AUI datepicker in my portlet. It is coming perfectly when I am accessing the jsp as popup, but while accessing directly inside my "view.jsp" then it is coming but not allowing me to perform any action like selecting the date.

Based on my observation it is going behind my theme. So because of that even if it is rendering but not allowing me to select.

Here is my sample code for date-picker


<aui:input name="taskStartDate" autocomplete="off" cssClass="font-size" value="<%=est_start_date%>" id="taskStartDate" onblur="validateDate(this, 'estStartDateMsg')" required="true" inlineLabel="true" label=" " onClick="onClickOfStartDate();" onkeypress="return isDateKey(event);" />	

<aui:script>
function  setactualStartDate(){
     
  AUI().use('aui-datepicker', function(A) {
      var simpleDatepicker1 = new A.DatePicker({
        trigger: '#<portlet:namespace />taskActualStartDate', 
         mask: '%Y-%m-%d',
          calendar: {
            dateFormat: '%Y-%m-%d',
        },
      }).render('##<portlet:namespace />taskactualStartDatePicker');
   });
}

function onClickOfStartDate(){
    setStartDate();
}
</aui:script>

Note: I had tried to put some z-index but still, I didn't succeeded to fulfill my requirement.

Can any body will help me!!!

Thanks,
~Chandan
thumbnail
Vilmos Papp,修改在9 年前。

RE: LIferay, AUI datepicker is not working

Liferay Master 帖子: 529 加入日期: 10-10-21 最近的帖子
I think perhaps you should put the method in a Liferay.provide() something like this:


<aui:script>
	Liferay.provide(
		window,
		'<portlet:namespace />saveConfiguration',
		function() {
			if (document.<portlet:namespace />fm.<portlet:namespace />assetVocabularyIds) {
				document.<portlet:namespace />fm.<portlet:namespace />assetVocabularyIds.value = Liferay.Util.listSelect(document.<portlet:namespace />fm.<portlet:namespace />currentAssetVocabularyIds);
			}

			submitForm(document.<portlet:namespace />fm);
		},
		['liferay-util-list-fields']
	);
</aui:script>


Please note, that <aui:script> shouldn't have a use='' argument, ortherwise it won't behave as a normal <script> tag, but will do lazy loading of the plugins.