如何用翡翠填写表格
how to fill out the table in Jade
我有一个对象数组
[{ name: Test1, phoneNumb: 123, email: abc }, {name: Test2, phoneNumb: 321, email: cba}, ...]
如何在Jade 中填写这些值的表格
如果您使用AngularJS,请尝试以下操作:
table
thead
tr
th Name
th Phone number
th Email
tbody
tr(ng-repeat='item in items')
td item.name
td item.phoneNumb
td item.email
在你的控制器中分配这样的项目集合:
$scope.items = [{ name: "Test1", phoneNumb: 123, email: "abc" }, {name: "Test2", phoneNumb: 321, email: "cba"}];
如果不使用AngularJS,请手动重复每个tr
标记。
table
thead
tr
th Name
th Phone number
th Email
tbody
和javascript函数:
function fillTable() {
var array = [{ name: "Test1", phoneNumb: 123, email: "abc" }, {name: "Test2", phoneNumb: 321, email: "cba"}];
var table = document.getElementById('table');
for(var i = 0; i < array.length; i++) {
var row = table.insertRow();
var name = row.insertCell(0);
var number = row.insertCell(1);
var email = row.insertCell(3);
name.innerHTML = array[i].name;
number.innerHTML = array[i].phoneNumb;
email.innerHTML = array[i].email;
}
}
相关文章:
- 我应该使用Ng提交还是点击表格
- CSS表格:从列平移到整个表格宽度
- 如何用更合适的内容替换document.write
- 将HTML表格导出到excel时,无法将数据加载到excel文件中
- CSS-若窗口太小,滚动条会出现在“表格”单元格上
- 滚动和表格
- 将谷歌自动完成地址信息放在页面上,而不是表格中
- Google电子表格getValue([cell containing ])不返回制表符
- 打印预览没有应用程序页眉和页脚的html表格
- 区分电子表格中的空单元格和0值
- 如何用javascript获取谷歌地图的经度和纬度
- 分页:如何用AJAX加载第一个页面
- 如何用背景色动态填充表格单元格
- 我是如何用有角度的方式张贴多个表格行的
- 如何用javascript从私人谷歌电子表格中读取数据——2014年11月
- 如何用水平滚动固定表格标题
- 如何用谷歌应用程序脚本替换电子表格中的文本
- 如何用翡翠填写表格
- 如何用JavaScript导出表格到excel
- 如何用jQuery选择隐藏表格中的行