如何使用jQuery做表单
2018-01-19 · 百度知道合伙人官方认证企业
html:
<div id="grid"樱野></div>
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 }
]);
}