datatable.html revision a3b15d60042c81a524cebb94370e5a234a19d04b
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<link rel="stylesheet" type="text/css" href="/build/cssbase/base-min.css">
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib font-family: sans-serif;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh font-size: smaller;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh padding: 5px;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh font-size:120%;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh background: #FFFCB6;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh border:1px solid #C9C675;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh #results dt {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh font-weight:bold;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh padding:3px;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh display:block;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh #results dd {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh font-weight:normal;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh color:grey;
90a3966dd44e306d23febc15ebd65cde07d7a4ddTed Gould #results dd span {
54e660c4de9d37185e3953165d053526632ef4f0johanengelen font-weight:bold;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p>To test the performance of various datatables, look at the following sections in the code:
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh//large or small dataset.
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6mikloshdata: large,
dd69425007680aafc47fdd994e1985625571d252bryce//---------------------------------------------
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh// Special instructions
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh//---------------------------------------------
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh //ignore following tests (good to do if you are doing a large dataset)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testBaseDatatable: true,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testXYDatatable: true,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testXDatatable: true,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testYDatatable_FixedCol: true,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testYDatatable_AutoCol: true,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testXYDatatable_BigHeaders: false
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Toggle <code>data</code> from <code>large</code> to <code>small</code> to get a different sized dataset. The <code>ignore</code> object determines which table to load. If testing performance, it is recommended that you only enable 1 table at a time.</p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p><input type="button" value="Run Tests" id="btnRun" disabled=true></p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<P>A general XY scrolling datatable. Column widths are provided for all columns, table width and height is provided.</p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p>A X-scrolling datatable. Column A and B have specified widths. The rest of the columns do not have any widths specified. Only a height of 200px is specified.</p>
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould<p>A Y-scrolling datatable. Column widths are provided for all columns, table height is provided. Since all cols have specified width, you may see this table overflowing past its container div (the blue div in the background). </p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p>A Y-scrolling datatable, where only the first 2 columns have a specified width. Only the table height is provided.</p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p>A XY-scrolling datatable, where only the first 2 columns have a specified width. Table height and width is provided. The table headers are of larger width than the table contents</p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<h3>Scrolling Datatable with no width or height set</h3>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh<p>A scrolling datatable with no width or height values passed in will result in a base datatable being created with auto width and height.</p>
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh(function() {
e66a49aa774c6770e99591a19873105bfeb5ce74Johan Engelen filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh allowRollup: false,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh useBrowserConsole: false
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh }).use("console", "test", "dump", "datatable", "profiler","node","json-parse", function(Y) {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // Set up the page
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var ASSERT = Y.Assert,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh ARRAYASSERT = Y.ArrayAssert,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh BTNRUN = Y.one("#btnRun"),
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh TestRunner = Y.Test.Runner;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh BTNRUN.set("disabled", false);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh TestRunner.subscribe(TestRunner.TEST_CASE_COMPLETE_EVENT, testCompleted);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.on("click", function(e){
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh BTNRUN.set("value", 'Running...');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh BTNRUN.set("disabled", true);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh }, BTNRUN);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh function testCompleted() {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh BTNRUN.set("value", 'Test Completed');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.log('Test Completed');
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen var myConsole = new Y.Console().render();
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh //large data set
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var large = [];
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib large[i] = {a: i+1, b:i+2, c:i+3, d: i+4, e: i+5, f: i+6, g:i+7};
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var small = [{a:3, b:2, c:1, d:6, e:7, f:2, g:0}, {a:9, b:8, c:7, d:6, e:7, f:2, g:0}, {a:1, b:2, c:3, d:6, e:7, f:2, g:0},
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh {a:3, b:2, c:1, d:6, e:7, f:2, g:0}, {a:9, b:8, c:7, d:6, e:7, f:2, g:0}, {a:1, b:2, c:3, d:6, e:7, f:2, g:0},
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh {a:3, b:2, c:1, d:6, e:7, f:2, g:0}, {a:9, b:8, c:7, d:6, e:7, f:2, g:0}, {a:1, b:2, c:3, d:6, e:7, f:2, g:0},
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh {a:3, b:2, c:1, d:6, e:7, f:2, g:0}, {a:9, b:8, c:7, d:6, e:7, f:2, g:0}, {a:1, b:2, c:3, d:6, e:7, f:2, g:0}];
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh nestedcols: [
05a66d0771cb563225b8690de04e9490b35453f2johanengelen cols: [{key:"a", field:"a", label:"AAA", sortable:true, className: ["oneClass", "anotherClass"], width:'75px'},{key:"b", abbr:"bbb", className:"myClass", width: '120px'},{key:"c", width:'75px'},{key:"d", width:'150px'},{key:"3", width:'75px'},{key:"f", width:'150px'},{key:"g", width:'75px'}],
05a66d0771cb563225b8690de04e9490b35453f2johanengelen cols2: [{key:"a", field:"a", label:"AAA", sortable:true, className: ["oneClass", "anotherClass"], width:'75px'},{key:"b", abbr:"bbb", className:"myClass", width:'75px'},{key:"c"},{key:"d"},{key:"e"},{key:"f"},{key:"g"}],
05a66d0771cb563225b8690de04e9490b35453f2johanengelen cols3: [{key:"a", field:"a", label:"Lorem Ipsum Dolor SIt Amet", sortable:true, className: ["oneClass", "anotherClass"], width:'5px'},{key:"b", abbr:"Lorem Ipsum Dolor SIt Amet", className:"myClass", width:'75px'},{key:"Lorem Ipsum Dolor SIt Amet"},{key:"Lorem Ipsum Dolor SIt Amet"},{key:"Lorem Ipsum Dolor SIt Amet"},{key:"Lorem Ipsum Dolor SIt Amet"},{key:"Lorem Ipsum Dolor SIt Amet"}],
05a66d0771cb563225b8690de04e9490b35453f2johanengelen //---------------------------------------------
05a66d0771cb563225b8690de04e9490b35453f2johanengelen //---------------------------------------------
05a66d0771cb563225b8690de04e9490b35453f2johanengelen //ignore following tests (good to do if you are doing a large dataset)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh //---------------------------------------------
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen //---------------------------------------------
6fb346988965d600415f2a8bbd5af507d82a1418Johan Engelen //this.rs = new Y.Recordset({records:this.initialData});
68b9e386db1a231abaddbfed4d05f7539bdac786scislac /////////////////////////////////////////////////////////////////////////////
68b9e386db1a231abaddbfed4d05f7539bdac786scislac /////////////////////////////////////////////////////////////////////////////
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould var dd = Y.Node.create('<dd>' + v.calls + ' call(s) at ' + v.avg + ' ms/call = <span>' + Math.round(v.avg*v.calls) + '</span> ms total</dd>');
05a66d0771cb563225b8690de04e9490b35453f2johanengelen /////////////////////////////////////////////////////////////////////////////
05a66d0771cb563225b8690de04e9490b35453f2johanengelen /////////////////////////////////////////////////////////////////////////////
05a66d0771cb563225b8690de04e9490b35453f2johanengelen testBaseDatatable: function() {
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould var sel = "#base";
05a66d0771cb563225b8690de04e9490b35453f2johanengelen this.dt = new Y.DataTable.Base({columnset:this.cols, recordset:this.data, caption:"Base"});
05a66d0771cb563225b8690de04e9490b35453f2johanengelen var msg = Y.Profiler.getAverage('dtBase') + 'ms taken to display';
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var report = Y.Profiler.getFullReport(this.reportParser);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac Y.log(msg, "time");
05a66d0771cb563225b8690de04e9490b35453f2johanengelen Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
7079a43aa387066c2f67402d77dbe3db981b1054Ted Gould testXYDatatable: function() {
05a66d0771cb563225b8690de04e9490b35453f2johanengelen var sel = '#scrolling-xy';
05a66d0771cb563225b8690de04e9490b35453f2johanengelen this.dt = new Y.DataTable.Base({columnset:this.cols, recordset:this.data, tdValueTemplate:"plug then render {value}", caption: "ScrollingDataTable"});
54e660c4de9d37185e3953165d053526632ef4f0johanengelen this.dt.plug(Y.Plugin.DataTableScroll, {width:"200px", height:"300px"});
68b9e386db1a231abaddbfed4d05f7539bdac786scislac var msg = Y.Profiler.getAverage('dtXY') + 'ms taken to display';
68b9e386db1a231abaddbfed4d05f7539bdac786scislac var report = Y.Profiler.getFullReport(this.reportParser);
68b9e386db1a231abaddbfed4d05f7539bdac786scislac Y.log(msg, "time");
68b9e386db1a231abaddbfed4d05f7539bdac786scislac Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
68b9e386db1a231abaddbfed4d05f7539bdac786scislac testXDatatable: function() {
68b9e386db1a231abaddbfed4d05f7539bdac786scislac var sel = "#scrolling-x";
68b9e386db1a231abaddbfed4d05f7539bdac786scislac this.dt = new Y.DataTable.Base({columnset:this.cols2, recordset:this.data, caption:"ScrollingDataTable"});
68b9e386db1a231abaddbfed4d05f7539bdac786scislac this.dt.plug(Y.Plugin.DataTableScroll, {width:"150px"});
68b9e386db1a231abaddbfed4d05f7539bdac786scislac var msg = Y.Profiler.getAverage('dtX') + 'ms taken to display';
68b9e386db1a231abaddbfed4d05f7539bdac786scislac var report = Y.Profiler.getFullReport(this.reportParser);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.log(msg, "time");
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib testYDatatable_FixedCol: function() {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var sel = "#scrolling-y";
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt = new Y.DataTable.Base({columnset:this.cols, recordset:this.data, tdValueTemplate:"plug then render {value}", caption:"ScrollingDataTable"});
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib this.dt.plug(Y.Plugin.DataTableScroll, {height:"300px"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var msg = Y.Profiler.getAverage('dtY1') + 'ms taken to display';
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var report = Y.Profiler.getFullReport(this.reportParser);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.log(msg, 'time');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testYDatatable_AutoCol: function() {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var sel = "#scrolling-colwidth";
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt = new Y.DataTable.Base({columnset:this.cols2, recordset:this.data, tdValueTemplate:"plug then render {value}", caption:"ScrollingDataTable"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt.plug(Y.Plugin.DataTableScroll, {height:"250px"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var msg = Y.Profiler.getAverage('dtY2') + 'ms taken to display';
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var report = Y.Profiler.getFullReport(this.reportParser);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.log(msg, 'time');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testXYDatatable_BigHeaders: function() {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var sel = "#scrolling-bigcols";
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt = new Y.DataTable.Base({columnset:this.cols3, recordset:this.data, tdValueTemplate:"plug then render {value}", caption:"ScrollingDataTable"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt.plug(Y.Plugin.DataTableScroll, {height:"250px", width:"400px"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var msg = Y.Profiler.getAverage('dtHeaders') + 'ms taken to display';
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var report = Y.Profiler.getFullReport(this.reportParser);
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.log(msg, 'time');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh testNoScrollDatatable: function() {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var sel = "#scrolling-noscroll";
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Profiler.start('dtNoScroll');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt = new Y.DataTable.Base({columnset:this.cols3, recordset:this.data, tdValueTemplate:"plug then render {value}", caption:"ScrollingDataTable"});
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Profiler.stop('dtNoScroll');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var msg = Y.Profiler.getAverage('dtNoScroll') + 'ms taken to display';
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var report = Y.Profiler.getFullReport(this.reportParser);
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen Y.log(msg, 'time');
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen Y.one(sel).appendChild('<p class="message">'+msg+'</p>');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh this.dt.scroll.set('width', '200px');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh test_uniqueRecordset: function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // Ticket #2529980
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var a = new Y.DataTable.Base(),
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh aRS = a.get('recordset'),
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib bRS = b.get('recordset');
17d87f5698f5c2958d38c6a6207c7b322a7adaf9johanengelen "caption should not be added to the DOM unless set": function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var container = Y.one("#base"),
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh table, caption;
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib caption: "Caption set"
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh caption = table.get('boundingBox').one('caption');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.areSame("Caption set", caption.get('text'));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh caption = table.get('boundingBox').one('caption');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh table.set('caption', 'Caption set');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh caption = table.get('boundingBox').one('caption');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.areSame('Caption set', caption.get('text'));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh "test table.datasource.load() updates UI": function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var data = [ {a:1,b:1,c:1}, {a:2,b:2,c:2}, {a:3,b:3,c:3} ],
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh container = Y.one('#base'),
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh source, table;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh source = new Y.DataSource.Local({ source: data });
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh resultFields: ['a','b','c']
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib columnset: [ { key: 'a', sortable: true }, 'b', 'c' ]
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib datasource: source
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould Y.Assert.areSame(0, container.all('tbody tr').size());
861fa436e7a6d6ff3eaa889b2298e0b82a0b238ctheadib Y.Assert.areSame(3, container.all('tbody tr').size());
861fa436e7a6d6ff3eaa889b2298e0b82a0b238ctheadib Y.Assert.areSame('1', container.one('tbody td').get('text'));
861fa436e7a6d6ff3eaa889b2298e0b82a0b238ctheadib data[0].a = 'NEW';
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould Y.Assert.areSame(3, container.all('tbody tr').size());
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould Y.Assert.areSame('NEW', container.one('tbody td').get('text'));
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib "test Recordset does not lose plugins on load": function () {
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould var data = [ {a:1,b:1,c:1}, {a:2,b:2,c:2}, {a:3,b:3,c:3} ],
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould container = Y.one('#base'),
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould source, table;
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould source = new Y.DataSource.Local({ source: data });
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould resultFields: ['a','b','c']
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib columnset: [ { key: 'a', sortable: true }, 'b', 'c' ]
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib datasource: source
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould recordset = table.get("recordset");
09ba3247163582bf2e30e17c4c154aa259ce038acilix "header rows should not have {placeholders}": function () {
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould // Ticket #2530026
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould var data = [ {a:1,b:1,c:1}, {a:2,b:2,c:2}, {a:3,b:3,c:3} ],
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould container = Y.one('#base'),
3bd80e038b72ad220f218d7053a9089685fab17cTed Gould source, table, html;
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib recordset: data,
5c45c5153b0415f7573f69f4ee3e946b5872a8d1theadib columnset: [ 'a', 'b', 'c' ]
63d6ddd517060979dd8b8fd41aad3faca7be3c5cTed Gould "cells should default content from column.emptyCellValue": function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // Ticket #2529921
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var data = [ {b:1,c:1,d:1},
1babefb17e4c8157ca2a0f588625a8ac0258dc53buliabyak {a:2,c:2,d:2},
1babefb17e4c8157ca2a0f588625a8ac0258dc53buliabyak {a:3,b:3,d:3},
1babefb17e4c8157ca2a0f588625a8ac0258dc53buliabyak {a:4,b:4,c:4} ],
1babefb17e4c8157ca2a0f588625a8ac0258dc53buliabyak container = Y.one('#base'),
45d0b0d0dc24df8e321cbe8a085ab9b1f60b4a42theadib source, table;
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh recordset: data,
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh columnset: [
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh { key: 'b', emptyCellValue: "(NO B)" },
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh emptyCellValue: "(NO C)" },
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh { key: 'd', formatter: function (o) {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh emptyCellValue: "(NO D)" }]
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.isNull(table._tbodyNode
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .getContent().match(/\{\s*\w+\s*\}/));
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.areSame('', table._tbodyNode.all('tr').item(0)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .all('.yui3-datatable-liner').item(0).getContent());
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.areSame('(NO B)', table._tbodyNode.all('tr').item(1)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .all('.yui3-datatable-liner').item(1).getContent());
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .all('.yui3-datatable-liner').item(2).getContent()
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh Y.Assert.areSame('(NO D)', table._tbodyNode.all('tr').item(3)
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh .all('.yui3-datatable-liner').item(3).getContent());
4b1c2be41ce8c1a88502c1b1885ad1468646fbfftheadib "setting the recordset should update the UI": function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh // http://yuilibrary.com/projects/yui3/ticket/2529920#comment:18
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var data = [ {a:1,b:1,c:1}, {a:2,b:2,c:2}, {a:3,b:3,c:3} ],
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh cell = table._tbodyNode.one('.yui3-datatable-liner');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh cell = table._tbodyNode.one('.yui3-datatable-liner');
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh "formatters should not have access to o.td by default": function () {
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh columnset: [
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh recordset: [
025db6f90298127a666cd24bcfc2e22fd35ca84dspeleo "createCell should populate o.td in formatters": function () {
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould columnset: [
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould .setContent(
ddc1f1d1291eb21b244c7328d260c7d4a43be2fcbuliabyak recordset: [{ a: "a1" }, { a: "a2" }, { a: "a3" }]
b7f07692f95074fdcf74c7350fbf5f3099ffc1b6miklosh var suite = new Y.Test.Suite("Datatable Test Suite");