Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html>
<head>
<meta http - equiv = "content-type"content = "text/html; charset=utf-8">
<title>Server - side Pagination and Sorting for Dynamic Data </title>
<link rel="stylesheet" type="text/css " href="datatable2.css " />
<script type="text / javascript " src="js / yahoo - dom - event.js "></script>
<script type="text / javascript " src="js / connection - min.js "></script>
<script type="text / javascript " src="js / dragdrop - min.js "></script>
<script type="text / javascript " src="js / dom - min.js "></script>
<script src="/my/local/yui3/build/yui/yui.js"></script>
<script src="custom_module.js"></script>
<script>
// This does not work
YUI({
base: '/my/local/yui3/build/',
modules:{
myapp:{
<!doctype html>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript">
YAHOO.util.Event.onContentReady('a', function () {
function defaultGenerateRequest(oState, oSelf) {
// Set defaults
oState = oState || { pagination: null, sortedBy: null };
var sort = encodeURIComponent((oState.sortedBy) ? oState.sortedBy.key :
oSelf.getColumnSet().keys[0].getKey()),
dir = (oState.sortedBy &&
oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ?
"desc" : "asc",
startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0,
// DataTable #3 - Checkbox click allows row selection
Ex.dataTable3.subscribe('rowClickEvent',Ex.dataTable3.onEventSelectRow);
Ex.dataTable3.subscribe('rowSelectEvent',Ex.dataTable3.check);
Ex.dataTable3.subscribe('unselectAllRowsEvent',Ex.dataTable3.uncheckAll);
var before = {
"12": "John",
"100": "Mary"
};
var after = [],
k;
for (k in before) {
if (before.hasOwnProperty(k)) {
// Step 1. simple assignment and retrieval
// set
var x = "Hello, world";
// get
alert(x);
// Step 2. object property assignment and retrieval
var x = {
foo: "Hello, world"
<!doctype html>
<html>
<head>
<title>Test Page</title>
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/combo?2.7.0/build/datatable/assets/skins/sam/datatable.css&2.7.0/build/paginator/assets/skins/sam/paginator.css">
</head>
<body class="yui-skin-sam">
<div id="pag"></div>
<div id="tbl"></div>
YUI({base: '/yui3/build/'}).use('node',function (Y) {
function report(source, context, args) {
console.log(
source, "\n",
"customContext.property( " + context.property + " )", "\n",
"callback args: " + [].slice.call(args).join(','));
}
// From Y.on
Y.Console.prototype.printBuffer = function (limit) {
var messages = this.buffer,
debug = Y.config.debug,
entries = Y.Node.create('div'),
consoleLimit= this.get('consoleLimit'),
newestOnTop = this.get('newestOnTop'),
anchor = newestOnTop ? this._body.get('firstChild') : null,
method = newestOnTop ? "prepend" : "append",
message,
entry,