Skip to content

Instantly share code, notes, and snippets.

@ghinch
Created March 19, 2010 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghinch/337987 to your computer and use it in GitHub Desktop.
Save ghinch/337987 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>
<title>Test</title>
<!-- Combo-handled YUI CSS files: -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0r4/build/button/assets/skins/sam/button.css&2.8.0r4/build/datatable/assets/skins/sam/datatable.css">
<!-- Combo-handled YUI JS files: -->
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/element/element-min.js&2.8.0r4/build/button/button-min.js&2.8.0r4/build/datasource/datasource-min.js&2.8.0r4/build/datatable/datatable-min.js"></script>
</head>
<body class="yui-skin-sam">
<button id="showBaz">Show Baz</button>
<button id="hideBaz">Hide Baz</button>
<div id="tableTest"></div>
<script type="text/javascript">
//<!--
(function () {
var Y = YAHOO;
var data = [
{foo: 'one', bar: 'aaa', baz: 'AAA', boo: 'tas'},
{foo: 'two', bar: 'bbb', baz: 'EEE', boo: 'sat'},
{foo: 'three', bar: 'ccc', baz: 'III', boo: 'sta'},
{foo: 'four', bar: 'ddd', baz: 'OOO', boo: 'ats'}
];
var ds = new Y.util.LocalDataSource(data);
var cols = [
{key : 'foo', label : "Foo"},
{key : 'bar', label : 'Bar'},
{key : 'bazboo', label : 'BazBoo', children : [
{key : 'baz', label : 'Baz'},
{key : 'boo', label : 'Boo'}
]}
];
var dt = new Y.widget.DataTable('tableTest', cols, ds);
var showBtn = new Y.widget.Button('showBaz', {
onclick : {
fn : function () {
var col = dt.getColumn('baz');
dt.showColumn(col);
}
}
});
var hideBtn = new Y.widget.Button('hideBaz', {
onclick : {
fn : function () {
var col = dt.getColumn('baz');
console.log(col); // It's getting the right column instance
dt.hideColumn(col); // Doesn't hide but doesn't throw an error
}
}
});
})();
-->
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment