datatable-basic-source.mustache revision a3b15d60042c81a524cebb94370e5a234a19d04b
<div id="simple" class="yui3-skin-sam dt-example"></div>
<div id="labels" class="yui3-skin-sam dt-example"></div>
<script type="text/javascript">
YUI().use("datatable-base", function (Y) {
var simpleCols = ["id","name","price"],
simpleData = [
{id:"ga_3475", name:"gadget", price:"$6.99"},
{id:"sp_9980", name:"sprocket", price:"$3.75"},
{id:"wi_0650", name:"widget", price:"$4.25"}
],
labeledCols = [
{key:"mfr_parts_database_id", label:"Mfr Part ID", abbr:"ID"},
{key:"mfr_parts_database_name", label:"Mfr Part Name", abbr:"Name"},
{key:"mfr_parts_database_price", label:"Wholesale Price", abbr:"Price"}
],
labeledData = [
{mfr_parts_database_id:"ga_3475", mfr_parts_database_name:"gadget", mfr_parts_database_price:"$6.99"},
{mfr_parts_database_id:"sp_9980", mfr_parts_database_name:"sprocket", mfr_parts_database_price:"$3.75"},
{mfr_parts_database_id:"wi_0650", mfr_parts_database_name:"widget", mfr_parts_database_price:"$4.25"}
],
dt1 = new Y.DataTable.Base({columnset:simpleCols, recordset:simpleData, summary:"Price sheet for inventory parts", caption:"Example table with simple columns"}).render("#simple"),
dt2 = new Y.DataTable.Base({columnset:labeledCols, recordset:labeledData, summary:"Price sheet for inventory parts", caption:"These columns have labels and abbrs"}).render("#labels");
});
</script>