This support forum belongs to the AlloyUI State Interaction Gallery Module.
AlloyUI State Interaction has a bug tracker here: http://issues.liferay.com/browse/AUI
| Page 1 of 1 | [ 9 posts ] |
|
When testing alloy-calendar, I try to set minDate after render call. An example:
var calendar = new A.Calendar({ trigger: '#calDateOut', dateFormat: '%d/%m/%Y', setValue: true, minDate: '25/06/2010', firstDayOfWeek: 0, on: { select: function(event) {} } }) .render(); calendar.set('minDate', '20/07/2010'); ... How to reproduce: - When calendar opens it begins with 06-month and 25-day (as first minDate). - If next month (07) is selected, minDate now is 20 (second minDate). - If you select previous month, now all days are disabled. There is an option to avoid that behaviour? |
Eduardo LundgrenYUI Contributor
|
Hey Gabriel,
We will support parse the date from a mask soon, although now the minDate/maxDate only support values supported by the Date constructor are supported. |
|
Hi,
I have the same issue. I'm trying to set the mindate and the maxdate after the calendar being rendered. The pagedate property is working properly but not mindate and maxdate. This post is one year old and this is still not supported. Please I need an update on this. Thank you. |
Eduardo LundgrenYUI Contributor
|
The minDate and maxDate supports the same value as the Date constructor, the documentation is fixed no on Alloy: http://alloy.liferay.com/deploy/api/Cal ... ig_maxDate
Are you guys trying to pass a valid date to the min/maxDate? |
|
Yes, I'm using the string format: 1/1/2011
I tried with a sample html page and I find out that it is working. The problem I'm on a Intersystem Cache env. and I have created a wrapper with the calendar. It is not possible for me to send a demo app. It seem that there is a refresh problem because I can't make the calendar rendering properly. When I send a mindate or maxdate on the initial constructor it work but not after it is created. Even if I recall the .render() method is still not refresh. If you have any idea, let me know. |
|
Eduardo, You and Alloy made a great job! Thank you.
If has not chance there is a non canonical way: A pseudo-continuation concept. (Was my 'solution'). With a custom event, your calendar can be rewrited by itself. (I don't now about garbage colector efects.) For example: 1. Add myRender() method to calendar object (you can use extend... etc.) 2. On myRender() method: 2.1. Colects all calendar's state info. 2.2. Destroy current calendar using set('innerHTML',''). 2.3. Call function that make new calendar (with a little timeout). 3. Append myRender() method to custom event. I hope Eduardo's solution will better than this. |
|
Thank you Gabriel. Do you have a code sample exposing what you are suggesting? I really not sure how to do it. A sample source code will be very appreciated and welcome.
I will be outside the office for the next two week therefore it will not be able to respond after today but this is still an important issue for me when I will be back. I really appreciate the quick answer by all of you. I'm impressed and it indicate me that I did the right choice by selecting Yahoo. By the way, Yahoo controls are very nice with a very good API documentation. I'm currently using the carousel and the calendar. Thank you. Patrick. |
Nate CavanaughYUI Contributor
|
Hi Gabriel,
While the solution you recommend could have memory impact, I just wanted you to know that we do have ways to clone widgets. All AlloyUI components support a .clone() method where you can either pass nothing, or a new object. If you pass nothing, the widget will be cloned with the same config object you originally passed in. If you pass in a new object, that one will be mixed into your original, and the result will be passed into the new clone. So for example: var calendar = new A.Calendar({ trigger: '#calDateOut', dateFormat: '%d/%m/%Y', setValue: true, minDate: '25/06/2010', }) .render(); var calendar1 = calendar.clone(); console.log(calendar.get('minDate')); // prints out 25/06/2010 console.log(calendar1.get('minDate')); // prints out 25/06/2010 var calendar2 = calendar.clone({minDate: '20/07/2010'}); console.log(calendar2.get('minDate')); // prints out 20/07/2010 console.log(calendar2.get('trigger')); // prints out '#calDateOut' Just wanted to let you know the options for (re-)creating widgets As for the bug/feature, Eduardo and I will try to get it resolved asap. Can you go to http://issues.liferay.com/browse/AUI , signup for an account and create a new ticket for this? Thanks Gabriel, |
|
Thanks Nate!
Your work is great! I am already signed at Liferay and I have post my question. I know that my solution is not best, but I can not obtain the result that I need with clone(). Maybe because I am doing something wrong. I am sure. I will post a code example. A calendar where it stablish it's own minDate in a cicle. I don't know how I can obtain the same with clone()? I know that this "continuation" is a brute force method. But (maybe), with refactoring, is the way to use new graphical components that not implements some functions. Code: function newCalendar(oMinDate) { new A.Calendar({ id: "xxCal", trigger: '#input1', dateFormat: '%m/%d/%Y', setValue: true, minDate: oMinDate, maxDate: null, firstDayOfWeek: 0, on: { select: function (event) { A.fire('calMinDate:newMinDate', event.date.formatted.toString()); } } }).render() } //Destroy DOM elements and make new calendar object function crtlCalendar(calMinDate) { A.Node.one('#xxCal').set('innerHTML', ''); A.Node.one('#xxCal').remove(); newCalendar(calMinDate); } A.on('calMinDate:newMinDate', crtlCalendar); //Now, our first object newCalendar('08/24/2010'); Note: Your comment served me to see the need to add "remove()". |
| Page 1 of 1 | [ 9 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group