JSFiddle - React, Tailwind, and code Playground

by maxibaezpy

HTML

<table id="myDataGrid" dojoType="dojox.grid.DataGrid">
        <thead>
        <tr>
            <th field="test">test</th>
        </tr>
        </thead>
</table>

JavaScript

dojo.require('dojox.grid.DataGrid');
dojo.require('dojo.data.ItemFileWriteStore');
dojo.require('dijit.form.Button');
//function init(){
    //createDom();
dojo.addOnLoad(function() {
    var grid = dijit.byId('myDataGrid');
    var itemList = [
        {test:145623},               
        {test:123123}
        ];
    var store = new dojo.data.ItemFileWriteStore({
        data: {
            items: itemList
        }
    });
    grid.setStore(store);
});
//}

function createDom(){
    var table = document.createElement("table");
    table.setAttribute("dojoType", "dojox.grid.DataGrid");
    table.setAttribute("id", "myDataGrid");
    document.body.appendChild(table);
    
    var thead = document.createElement("thead");
    var tr = document.createElement("tr");
    var th = document.createElement("th");
    th.setAttribute("field","test");
    th.appendChild(document.createTextNode("test"));
    
    table.appendChild(thead);
    thead.appendChild(tr);
    tr.appendChild(th);
}