This support forum belongs to the calendar Gallery Module.
calendar has a bug tracker here: http://github.com/jayli/yui3-gallery/issues
| Page 1 of 1 | [ 7 posts ] |
|
First of all I think this is a great module.
I have two questions: 1. When I use the selected option and the selected date is not in the current month than the calendar starts still in the current year/month. Is it possible to start the calendar in the selected date. example from the example script: //Popup calendar, click on the vacant space to close the calendar new Y.Calendar('J_popup_closeable',{ selected:showdate(-20,new Date()), popup:true, closeable:true }).on('select',function(d){ alert(d); }); 2. Is it possible to pre-format the returned date time function: instead of using this: new Y.Calendar('btn_calendar',{ selected:showdate(-20,new Date()), closeable:true, popup:true }).on('select',function(d) { alert(Y.DataType.Date.format(d, {format:"%Y-%m-%d %T"})); }); new Y.Calendar('btn_start_datum',{ selected:new Date(Y.one('#start_datum').get('value')), format:'%Y-%m-%d %T', closeable:true, popup:true }).on('select',function(d) { alert(d); }); The second question is a nice to have. |
|
re 1 - try calling the render method with your selected date. eg:
Code: c = new Y.Calendar ... c.render({selected:c.date}) |
|
Unfortunately this doesn't solve it.
Perhaps something wrong in my code: http://www.digirent.nl/psmyui/vb/cal1.html Any clues? |
|
.. sorry .. forgot I had to do a bit more (this really should be in the code base)
I run with a local copy of the module, and inserted at line 190 a fire of the show event: Code: that.EV[1] = Y.one('#'+that.id).on('click',function(e){ e.halt(); if(that.con.getStyle('visibility') === 'hidden'){ that.EventCenter.fire("show"); // <-------- insert fire of show event that.show(); }else{ that.hide(); } }); Then I coded to do the render, on show. eg: Code: var c = new Y.Calendar('btn_start_datum',{ selected:new Date(Y.one('#start_datum').get('value')), closeable:true, popup:true }); c.on('show', function() { c.render({selected:c.date}) }); c.on('select',function(d) { Y.one('#start_datum').set('value',Y.DataType.Date.format(d, {format:"%Y-%m-%d %T"})); }); See if that helps ... |
|
I figured the following out instead of using "selected" I had to use "date"
new Y.Calendar('J_popup_closeable',{ date:showdate(-20,new Date()), popup:true, closeable:true }).on('select',function(d) This renderes the calendar properly only when using the time fields these are not adjusted, |
|
That may run into problems once the calendar is instantiated (from memory I think I tried that). ie, on your first calendar open it's fine, but manually change your input field, and then open the calendar again, and it may not render correctly (try it by varying the month so it takes the calendar out of it's current view).
|
|
Thanks for thinking with me. With the extra fire event in the gallery-calendar.js and the following with the selected instead of the date is working correctly:
var c = new Y.Calendar('btn_start_datum',{ selected:new Date(Y.one('#start_datum').get('value')), closeable:true, popup:true }); c.on('show', function() { c.render({selected:new Date(Y.one('#start_datum').get('value'))}) }); c.on('select',function(d) { Y.one('#start_datum').set('value',Y.DataType.Date.format(d, {format:"%Y-%m-%d"})); }); see also http://www.digirent.nl/psmyui/vb/cal1.html |
| Page 1 of 1 | [ 7 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