简体   繁体   中英

How to create table in dojo 1.9

I am developing a sample project in Worklight which uses DOJO.In this project i am trying to generate a table in view.Initially i tried with "Datagrid" here data is not displaying properly.

js file

data = [
                { abbr:'ec', name:'Ecuador', capital:'Quito' },
                // ... array of data ...
            ];
            // create an object store
            var objectStore = new dojo.store.Memory({
                data: data
            });
            grid = new dojox.grid.DataGrid({
                // use the adapter to give the grid a Dojo Data compliant interface to the store
                store: dojo.data.ObjectStore({objectStore: objectStore}),
                structure: [
                    {name:"Country", field:"name", width: "150px"},
                    {name:"Abbreviation", field:"abbr"},
                    {name:"Capital", field:"capital"}
                ]
            }, "grid");
            grid.startup();

html

<div data-dojo-type="dojox.mobile.ScrollableView" id="View1"
        data-dojo-props="selected:false,scrollDir:'v'">
        <div data-dojo-type="dojox.mobile.Heading"
            data-dojo-props="label:'Details',fixed:'top'"></div>

<div id="grid"></div>



        <div data-dojo-type="dojox.mobile.Heading"
            data-dojo-props="fixed:'bottom'"></div>
    </div>

Here data is displaying but on top of column heading .

Is there any other way to populate table programatically in dojo.

Any help is appretiated.

您只需要确保已导入网格CSS ::

/dojox/grid/resources/claroGrid.css

you can get dgrid at github.com. dgrid is a lightweight, mobile-ready, data-driven, modular grid widget designed for use with the Dojo object store It has many examples, you can get it soon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM