当前位置: 首页 > 工具软件 > dgrid > 使用案例 >

dgrid的store设置

蔺劲
2023-12-01

dojo的store

var oldStore = new Observable(new Cache(
    new JsonRest({ target: "exemple/" }),
    new Memory()
));
var store = new StoreAdapter({ objectStore: oldStore });

i will try it!

还有这个:

require([
    "dojo/_base/declare",
    "dojo/request",
    "dojo/store/Memory",
    "dgrid/Grid",
    "dgrid/extensions/Pagination"
], function (declare, request, Memory, Grid, Pagination) {
    request("hof-batting.json", {
        handleAs: "json"
    }).then(function (response) {
        // Once the response is received, build an in-memory store
        // with the data
        var store = new Memory({ data: response });
 
        // Create a Grid instance using Pagination,
        // referencing the store
        var grid = new (declare([Grid, Pagination]))({
            store: store,
            className: "dgrid-autoheight",
            columns: {
                first: "First Name",
                last: "Last Name",
                totalG: "Games Played"
            }
        }, "grid");
 
        grid.startup();
    });
});



题外话,dojo缺少经典的例子!有些东西,完全不知道怎么用,不知道怎么使用更合适。本来使用dojo的人也不多了,再加上找不到像样的例子,真的是没法办!

也许dojo自带的例子还不错,但是,能不能应用到企业开发中去?我们不需要玩具!

 类似资料: