2

I'm trying to extend a dojox.grid.DataGrid just to add some defaults in JS. I'm adding it to the page the declarative way like this:

Html Page

<table dojoType="my.DataGrid">
    <thead>
        <tr>
            <th width="30px" field="num">N°</th>
            <th width="auto" field="email">E-mail</th>
            <th width="auto" field="name" editable="true">Full name</th>
            <th width="120px" field="hours" editable="true">Hours</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

JS File

dojo.provide("my.DataGrid");
dojo.require("dojox.grid.DataGrid");
dojo.declare("my.DataGrid", [ dojox.grid.DataGrid ], {
    summary: "My Not Working DataGrid"
});

It works perfectly using dojox.grid.DataGrid but when I try to extend it, nothing shows up. I'm using dojo 1.6 (I know it's old, I can't upgrade it). I know it is working because I can access it via dijit.registry._hash but It won't render even calling render() or startup().

Any help is appreciated!

Arkanoid
  • 1,165
  • 8
  • 17

2 Answers2

0

I have the same problem here, I'm trying to extend the functionality of the grid but when I do it, it doesn't render. Can't use a more recent version of dojo either. Stuck in 1.6.

dacabdi
  • 344
  • 4
  • 14
0

in the DataGrid.js there are tow functions for rendering the widget from html-markup.

dojox.grid.DataGrid.cell_markupFactory

and

dojox.grid.DataGrid.markupFactory

you have to override them in your new Grid class with your own package name e.g

com.mycompany.grid.MyGrid.cell_markupFactory

and

com.mycompany.grid.MyGrid.markupFactory

then it works!!!

DIF
  • 2,470
  • 6
  • 35
  • 49
mmbarek
  • 1
  • 1