Skip to content

Instantly share code, notes, and snippets.

@santiago
Created January 14, 2009 16:39
Show Gist options
  • Save santiago/46955 to your computer and use it in GitHub Desktop.
Save santiago/46955 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Basic Example</title>
<style type="text/css">
/*margin and padding on body element
can introduce errors in determining
element position and are not recommended;
we turn them off as a foundation for YUI
CSS treatments. */
body {
margin:0;
padding:0;
}
.cal-first-uh {
border-top:1px solid;
}
.cal-last-uh {
border-bottom:1px solid;
bottom:0;
position:relative;
}
</style>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datatable/datatable-min.js"></script>
<style type="text/css">
/* custom styles for this example */
.yui-skin-sam .yui-dt-liner { white-space:nowrap; }
</style>
<!--end custom header content for this example-->
</head>
<body class=" yui-skin-sam">
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
<div id="basico"></div>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function() {
Basico = function() {
Data = {
events: [
{s:1, m:0, t:0, w:0, th:0, f:0, sa:0},
{s:0, m:1, t:0, w:0, th:0, f:0, sa:0},
{s:0, m:0, t:1, w:0, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:1, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:0, th:1, f:0, sa:0},
{s:0, m:0, t:0, w:0, th:0, f:0, sa:1},
{s:0, m:0, t:0, w:0, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:0, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:1, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:1, th:0, f:0, sa:0},
{s:0, m:0, t:0, w:2, th:0, f:0, sa:0}
]
};
var last_events = Data.events[0];
var formatEvent = function ( el , oRecord , oColumn , oData) {
if (oData == 1) {
el.innerHTML = "X";
YAHOO.util.Dom.addClass(el, "cal-first-uh");
}
if (oData == 2) {
}
};
var myColumnDefs = [
{key:"s", label:"domingo", width:"100", formatter:formatEvent},
{key:"m", label:"lunes", width:"100", formatter:formatEvent},
{key:"t", label:"martes", width:"100", formatter:formatEvent},
{key:"w", label:"miercoles", width:"100", formatter:formatEvent},
{key:"th", label:"jueves", width:"100", formatter:formatEvent},
{key:"f", label:"viernes", width:"100", formatter:formatEvent},
{key:"sa", label:"sabado", width:"100", formatter:formatEvent}
];
var myDataSource = new YAHOO.util.DataSource(Data.events);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
fields: ["s","m","t","w","th","f","sa"]
};
var myDataTable = new YAHOO.widget.DataTable("basico",
myColumnDefs, myDataSource, {caption:"Calendario Ceiba"});
return {
oDS: myDataSource,
oDT: myDataTable
};
}();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment