繼the documentation of the YUI DataTable control我已經推斷出下面的代碼:如何渲染YUI數據表?
<!DOCTYPE HTML>
<HTML>
<HEAD>
<SCRIPT type="text/javascript" src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></SCRIPT>
<SCRIPT type="text/javascript">
// Create a new YUI instance and populate it with the required modules.
YUI().use('datatable', function (Y) {
// Columns must match data object property names
var data = [
{ id: "ga-3475", name: "gadget", price: "$6.99", cost: "$5.99" },
{ id: "sp-9980", name: "sprocket", price: "$3.75", cost: "$3.25" },
{ id: "wi-0650", name: "widget", price: "$4.25", cost: "$3.75" }
];
var table = new Y.DataTable({
columns: ["id", "name", "price"],
data: data,
// Optionally configure your table with a caption
caption: "My first DataTable!",
// and/or a summary (table attribute)
summary: "Example DataTable showing basic instantiation configuration"
});
table.render("#example");
});
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
侮辱性的事情是,文件說:
此代碼生成此表:
,只是此代碼生成此表格:
所以很顯然,我失去了一些東西有關如何呈現YUI數據表非常基本的。什麼是呈現YUI數據表的正確方法?
問:如何渲染YUI數據表?
Another page提到包括<div>
,從空改變我<BODY>
到:
<BODY>
<div class="example yui3-skin-sam">
<div id="simple"></div>
<div id="labels"></div>
</div>
</BODY>
,但不會改變控件的外觀。
我試圖做出我認爲從筆記推斷的變化。它沒有工作。你可以用你提出的改變發佈代碼嗎? –
http://jsbin.com/3/ebadiq/1/edit?html,live – Luke