我想使用Dgrid的store属性,我使用下面的代码制作dgrid表但不知道表格是不是用行填充。
<script src="dojo/dojo.js"
data-dojo-config="async: true"></script>
<script>
require(["dojo/_base/declare","dgrid/Grid","dgrid/Keyboard","dgrid/Selection","dgrid/editor","dgrid/extensions/DnD","dojo/dnd/Source", "dojo/store/Memory", "dojo/_base/lang"],
function (declare,Grid,Keyboard,Selection,editor,DnD, DnDSource, Memory, lang){
var store = new Memory({
data: [
{ id: 1, firstName: "Jeffrey", lastName: "Andrews", email: "jeffrey@madeupdomain.com" },
{ id: 2, firstName: "Jenny", lastName: "Saunders", email: "jenny@madeupdomain.com" },
]
});
var structure = [
{field: "lastName", label: "Last Name"},
{field: "firstName", label: "First Name"},
{field: "email", label: "EMail Address"}
];
var grid = new (declare([Grid, Selection, DnD]))({
store: store,
columns: structure
},
"gridtable");
grid.startup();
});
</script>
</head>
<div id="gridtable"></div>
答案 0 :(得分:0)
基本List
和Grid
模块并非设计为存储感知。商店知晓度通常从_StoreMixin
继承,OnDemandList
和Pagination
扩展名继承。
自己扩展_StoreMixin
也是可行的;例如,dgrid.io上的其中一个教程遍历very simple extension to render all data from a store at once。