如何用jQuery做一个表格组件
答案:1 悬赏:50 手机版
解决时间 2021-04-14 19:44
- 提问者网友:十年饮冰
- 2021-04-14 11:59
如何用jQuery做一个表格组件
最佳答案
- 五星知识达人网友:行雁书
- 2021-04-14 12:39
html:
js:
$("#grid").datagrid({
width: 600,
height: 400,
columns: [
{ text: "名称", field: "name", width: 200 },
{ text: "年龄", field: "age" },
{ text: "日期", field: "birthday",
renderer: function (value, row, col) { if (value && value.getFullYear) {
value = value.getFullYear() + "-" + (value.getMonth() + 1) + "-" + value.getDate();
} return value;
}
}
],
data: [
{ name: "name1", age: 20, birthday: new Date() },
{ name: "name1", age: 20, birthday: new Date() },
{ name: "name1", age: 20, birthday: new Date() },
{ name: "name1", age: 20, birthday: new Date() },
{ name: "name1", age: 20, birthday: new Date() }
]
}); function addRow() { var grid = $("#grid").data("datagrid");
grid.addRow({ name: "bbb" });
} function setColumns() {
var grid = $("#grid").data("datagrid");
grid.setColumns([
{ text: "Name", field: "name", width: 150 },
{ text: "Age", field: "age", width: 150 }
]);
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯