02 – YUI 3.5 Javascript Datatable

In this video I show how to apply the alternate night skin, how to change the column labels and how to allow HTML in the cells.

datatable.js

[crayon language="javascript"]
YUI({ skin: ‘night’ }).use(‘datatable’, function (Y) {
var data = [
{ id: "353", name: "Shanghai", country: "China", population: "17836133",
details: "details" },
{ id: "347", name: "Instanbul", country: "Turkey", population: "13483052" },
{ id: "456", name: "Karachi", country: "Pakistan", population: "13052000" }
];
var table = new Y.DataTable({
data: data,
columns: [
{ key: "id", label: "Id" },
{ key: "name", label: "City Name" },
{ key: "country", label: "Country" },
{ key: "population", label: "Population" },
{ key: "details", label: "", allowHTML: true } ],
caption: “World’s largest cities proper”
});
table.render(“#cities”);
});
[/crayon]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>