更新时间:2023-12-01 09:04:46
您可以通过调用 addRows()
方法.如果您使用的是 YUI可排序数据表示例,则可以执行此操作方式:
You can dynamically add rows into a YUI dataTable
by calling the addRow()
or addRows()
method. If you are using the YUI sortable dataTable example, you could do it this way:
table.addRows(
[{Company:"New Company", Phone:"555-555-5555", Contact:"John Smith"},
{Company:"Old Company", Phone:"555-555-6666", Contact:"Rowdy Piper"}]);
使用 addColumn()
:
table.addColumn({key:"NewColumn", label:"Column D"});
注意:您必须在代码中包含datatable-mutable
模块才能使用这些方法.
Note: you must include the datatable-mutable
module in your code to utilize these methods.