Skip to content

Commit

Permalink
Adding workaround file to DataTable tests. Moving DT examples from Lo…
Browse files Browse the repository at this point in the history
…ader into onDOMReady callbacks.
  • Loading branch information
lsmith committed Nov 9, 2009
1 parent 7db2919 commit 97d0332
Show file tree
Hide file tree
Showing 29 changed files with 518 additions and 478 deletions.
3 changes: 2 additions & 1 deletion yui2.8/examples/datatable/dt_autocomplete_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<script type="text/javascript" src="yui/autocomplete/autocomplete-min.js"></script> <script type="text/javascript" src="yui/autocomplete/autocomplete-min.js"></script>
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>


<!--there is no custom header content for this example--> <!--there is no custom header content for this example-->


Expand Down Expand Up @@ -130,7 +131,7 @@ <h1>Datatable with Autocomplete</h1>
} }
]; ];


myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?"); myDataSource = new YAHOO.util.DataSource("../yui2.8/examples/datatable/assets/php/ylocal_proxy.php?");
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.connXhrMode = "queueRequests"; myDataSource.connXhrMode = "queueRequests";
myDataSource.responseSchema = { myDataSource.responseSchema = {
Expand Down
1 change: 1 addition & 0 deletions yui2.8/examples/datatable/dt_basic_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
5 changes: 3 additions & 2 deletions yui2.8/examples/datatable/dt_bhm_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/paginator/paginator-min.js"></script> <script type="text/javascript" src="yui/paginator/paginator-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down Expand Up @@ -59,7 +60,7 @@ <h1>Integrating Browser History Manager with Server-side Pagination and Sorting<


<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->


<iframe id="yui-history-iframe" src="assets/html/blank.html"></iframe> <iframe id="yui-history-iframe" src="../yui2.8/examples/datatable/assets/html/blank.html"></iframe>
<input id="yui-history-field" type="hidden"> <input id="yui-history-field" type="hidden">


<div id="dt-pag-nav"></div> <div id="dt-pag-nav"></div>
Expand All @@ -68,7 +69,7 @@ <h1>Integrating Browser History Manager with Server-side Pagination and Sorting<
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {
// Create the DataSource // Create the DataSource
var myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?"); var myDataSource = new YAHOO.util.DataSource("../yui2.8/examples/datatable/assets/php/json_proxy.php?");
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = { myDataSource.responseSchema = {
resultsList: "records", resultsList: "records",
Expand Down
3 changes: 2 additions & 1 deletion yui2.8/examples/datatable/dt_cellediting_caja.html
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "#"> <!doctype html>
<html> <html>
<head> <head>


Expand Down Expand Up @@ -26,6 +26,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
3 changes: 2 additions & 1 deletion yui2.8/examples/datatable/dt_cellselect_caja.html
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "#"> <!doctype html>
<html> <html>
<head> <head>


Expand All @@ -24,6 +24,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
3 changes: 2 additions & 1 deletion yui2.8/examples/datatable/dt_clientpagination_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<script type="text/javascript" src="yui/paginator/paginator-min.js"></script> <script type="text/javascript" src="yui/paginator/paginator-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down Expand Up @@ -72,7 +73,7 @@ <h1>Client-side Pagination</h1>
{key:"number", label:"Number"} {key:"number", label:"Number"}
]; ];


var myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?"); var myDataSource = new YAHOO.util.DataSource("../yui2.8/examples/datatable/assets/php/json_proxy.php?");
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
myDataSource.responseSchema = { myDataSource.responseSchema = {
resultsList: "records", resultsList: "records",
Expand Down
1 change: 1 addition & 0 deletions yui2.8/examples/datatable/dt_clientsorting_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>


<!--there is no custom header content for this example--> <!--there is no custom header content for this example-->


Expand Down
244 changes: 124 additions & 120 deletions yui2.8/examples/datatable/dt_colshowhide_caja.html
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "#"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "#">
<html> <html>
<head> <head>
<link type="text/css" rel="stylesheet" href="yui/fonts/fonts.css">
<link rel="stylesheet" type="text/css" href="yui/button/assets/skins/sam/button.css">
<link rel="stylesheet" type="text/css" href="yui/container/assets/skins/sam/container.css">
<link rel="stylesheet" type="text/css" href="yui/datatable/assets/skins/sam/datatable.css">
<style type="text/css"> <style type="text/css">
/* custom styles for this example */ /* custom styles for this example */
#dt-example {width:45em;margin:0 auto;} #dt-example {width:45em;margin:0 auto;}
Expand Down Expand Up @@ -91,130 +95,130 @@ <h1>Showing, Hiding, and Reordering Columns</h1>
</div> </div>
</div> </div>


<script type="text/javascript" src="yui/yuiloader/yuiloader.js"></script> <script src="yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="./assets/js/data.js"></script> <script src="yui/element/element.js"></script>
<script type="text/javascript"> <script src="yui/button/button.js"></script>
var loader = new YAHOO.util.YUILoader(); <script src="yui/dragdrop/dragdrop.js"></script>
loader.insert({ <script src="yui/container/container.js"></script>
require: ["fonts", "dragdrop", "container", "button", "datatable"], <script src="yui/datasource/datasource.js"></script>
base: 'yui/', <script src="yui/datatable/datatable.js"></script>
filter: 'debug', <script type="text/javascript" src="yui/workaround.js"></script>
allowRollup: false, <script type="text/javascript" src="assets/js/data.js"></script>
onSuccess: function() { <script>
YAHOO.example.ColumnShowHide = function() { YAHOO.util.Event.onDOMReady(function () {
// Define Columns YAHOO.example.ColumnShowHide = (function() {
var myColumnDefs = [ // Define Columns
{key:"address"}, var myColumnDefs = [
{key:"city"}, {key:"address"},
{key:"state"}, {key:"city"},
{key:"amount"}, {key:"state"},
{key:"active"}, {key:"amount"},
{key:"colors"}, {key:"active"},
{key:"last_login", formatter:YAHOO.widget.DataTable.formatDate} {key:"colors"},
]; {key:"last_login", formatter:YAHOO.widget.DataTable.formatDate}

];
// Create DataSource
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:"date"}]
};

// Create DataTable
var myDataTable = new YAHOO.widget.DataTable("columnshowhide", myColumnDefs, myDataSource, {draggableColumns:true});

// Shows dialog, creating one when necessary
var newCols = true;
var showDlg = function(e) {
YAHOO.util.Event.stopEvent(e);


if(newCols) { // Create DataSource
// Populate Dialog var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
// Using a template to create elements for the SimpleDialog myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
var allColumns = myDataTable.getColumnSet().keys; myDataSource.responseSchema = {
var elPicker = YAHOO.util.Dom.get("dt-dlg-picker"); fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:"date"}]
var elTemplateCol = document.createElement("div"); };
YAHOO.util.Dom.addClass(elTemplateCol, "dt-dlg-pickercol");
var elTemplateKey = elTemplateCol.appendChild(document.createElement("span")); // Create DataTable
YAHOO.util.Dom.addClass(elTemplateKey, "dt-dlg-pickerkey"); var myDataTable = new YAHOO.widget.DataTable("columnshowhide", myColumnDefs, myDataSource, {draggableColumns:true});
var elTemplateBtns = elTemplateCol.appendChild(document.createElement("span"));
YAHOO.util.Dom.addClass(elTemplateBtns, "dt-dlg-pickerbtns");
var onclickObj = {fn:handleButtonClick, obj:this, scope:false };


// Create one section in the SimpleDialog for each Column // Shows dialog, creating one when necessary
var elColumn, elKey, elButton, oButtonGrp; var newCols = true;
for(var i=0,l=allColumns.length;i<l;i++) { var showDlg = function(e) {
var oColumn = allColumns[i]; YAHOO.util.Event.stopEvent(e);


// Use the template if(newCols) {
elColumn = elTemplateCol.cloneNode(true); // Populate Dialog

// Using a template to create elements for the SimpleDialog
// Write the Column key var allColumns = myDataTable.getColumnSet().keys;
elKey = elColumn.firstChild; var elPicker = YAHOO.util.Dom.get("dt-dlg-picker");
elKey.innerHTML = oColumn.getKey(); var elTemplateCol = document.createElement("div");

YAHOO.util.Dom.addClass(elTemplateCol, "dt-dlg-pickercol");
// Create a ButtonGroup var elTemplateKey = elTemplateCol.appendChild(document.createElement("span"));
oButtonGrp = new YAHOO.widget.ButtonGroup({ YAHOO.util.Dom.addClass(elTemplateKey, "dt-dlg-pickerkey");
id: "buttongrp"+i, var elTemplateBtns = elTemplateCol.appendChild(document.createElement("span"));
name: oColumn.getKey(), YAHOO.util.Dom.addClass(elTemplateBtns, "dt-dlg-pickerbtns");
container: elKey.nextSibling var onclickObj = {fn:handleButtonClick, obj:this, scope:false };
});
oButtonGrp.addButtons([ // Create one section in the SimpleDialog for each Column
{ label: "Show", value: "Show", checked: ((!oColumn.hidden)), onclick: onclickObj}, var elColumn, elKey, elButton, oButtonGrp;
{ label: "Hide", value: "Hide", checked: ((oColumn.hidden)), onclick: onclickObj} for(var i=0,l=allColumns.length;i<l;i++) {
]); var oColumn = allColumns[i];


elPicker.appendChild(elColumn); // Use the template
} elColumn = elTemplateCol.cloneNode(true);
newCols = false;
} // Write the Column key
myDlg.show(); elKey = elColumn.firstChild;
}; elKey.innerHTML = oColumn.getKey();
var hideDlg = function(e) {
this.hide(); // Create a ButtonGroup
}; oButtonGrp = new YAHOO.widget.ButtonGroup({
var handleButtonClick = function(e, oSelf) { id: "buttongrp"+i,
var sKey = this.get("name"); name: oColumn.getKey(),
if(this.get("value") === "Hide") { container: elKey.nextSibling
// Hides a Column });
myDataTable.hideColumn(sKey); oButtonGrp.addButtons([
} { label: "Show", value: "Show", checked: ((!oColumn.hidden)), onclick: onclickObj},
else { { label: "Hide", value: "Hide", checked: ((oColumn.hidden)), onclick: onclickObj}
// Shows a Column ]);
myDataTable.showColumn(sKey);
elPicker.appendChild(elColumn);
} }
}; newCols = false;

}
// Create the SimpleDialog myDlg.show();
YAHOO.util.Dom.removeClass("dt-dlg", "inprogress"); };
var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", { var hideDlg = function(e) {
width: "30em", this.hide();
visible: false, };
modal: true, var handleButtonClick = function(e, oSelf) {
buttons: [ var sKey = this.get("name");
{ text:"Close", handler:hideDlg } if(this.get("value") === "Hide") {
], // Hides a Column
fixedcenter: true, myDataTable.hideColumn(sKey);
constrainToViewport: true }
}); else {
myDlg.render(); // Shows a Column
myDataTable.showColumn(sKey);
}
};

// Create the SimpleDialog
YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
width: "30em",
visible: false,
modal: true,
buttons: [
{ text:"Close", handler:hideDlg }
],
fixedcenter: true,
constrainToViewport: true
});
myDlg.render();


// Nulls out myDlg to force a new one to be created // Nulls out myDlg to force a new one to be created
myDataTable.subscribe("columnReorderEvent", function(){ myDataTable.subscribe("columnReorderEvent", function(){
newCols = true; newCols = true;
YAHOO.util.Event.purgeElement("dt-dlg-picker", true); YAHOO.util.Event.purgeElement("dt-dlg-picker", true);
YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = ""; YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = "";
}, this, true); }, this, true);


// Hook up the SimpleDialog to the link // Hook up the SimpleDialog to the link
YAHOO.util.Event.addListener("dt-options-link", "click", showDlg, this, true); YAHOO.util.Event.addListener("dt-options-link", "click", showDlg, this, true);


return { return {
oDS: myDataSource, oDS: myDataSource,
oDT: myDataTable oDT: myDataTable
}; };
}(); })();
}
}); });
</script> </script>
</body> </body>
Expand Down
1 change: 1 addition & 0 deletions yui2.8/examples/datatable/dt_complex_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<script type="text/javascript" src="yui/paginator/paginator-min.js"></script> <script type="text/javascript" src="yui/paginator/paginator-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
1 change: 1 addition & 0 deletions yui2.8/examples/datatable/dt_contextmenu_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
1 change: 1 addition & 0 deletions yui2.8/examples/datatable/dt_ddrows_caja.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<script type="text/javascript" src="yui/element/element-min.js"></script> <script type="text/javascript" src="yui/element/element-min.js"></script>
<script type="text/javascript" src="yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="yui/datasource/datasource-min.js"></script>
<script type="text/javascript" src="yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="yui/datatable/datatable-min.js"></script>
<script type="text/javascript" src="yui/workaround.js"></script>




<!--begin custom header content for this example--> <!--begin custom header content for this example-->
Expand Down
Loading

0 comments on commit 97d0332

Please sign in to comment.