Skip to content

Instantly share code, notes, and snippets.

@stlsmiths
Created November 27, 2012 16:47
Show Gist options
  • Save stlsmiths/4155407 to your computer and use it in GitHub Desktop.
Save stlsmiths/4155407 to your computer and use it in GitHub Desktop.
Creating a View instance to wrap a Popup Calendar in an Overlay
//
// Double-click on a cell in last column "Trans Date", opens a pop-up Calendar
// in an Overlay
// http://www.blunderalong.com/yui/dta/editing/dt_cellediting.html
PopupCalView = Y.Base.create('popupCal',Y.View,[],{
// Setup static properties to hold instances of Overlay and Calendar
_overlay: null,
_calendar: null,
initializer: function(){
var cont = this.get('container'),
ovCfgs = this.get('overlayConfigs') || {},
calCfgs = this.get('calConfigs') || {};
// Set defaults for Overlay configuration and create the overlay, but don't display it
ovCfgs.srcNode = cont;
ovCfgs.visible = false;
this._overlay = new Y.Overlay(ovCfgs);
this._overlay.render();
// Add a calendar Node to the Overlay Body
this._overlay.set('bodyContent','<div class="myCalDIV"></div>");
// Now create the Calendar instance pointing to the DIV in the Overlay
var calDiv = cont.one('.myCalDIV');
if(calDiv) {
calCfgs.contentBox = calDiv;
this._calendar = new Y.Calendar(calCfgs);
}
// At this point we SHOULD have an Overlay instance created/rendered (but not displayed),
// with a Calendar widget inside the Body.
},
destructor: function(){
},
render: function() {
}
},{
ATTRS:{
date: {},
calConfigs : {},
overlayConfigs: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment