Login Register

1.2 DataGrid fails on IE7 when doing setStructure within dojo/method

I am getting an error in IE7 (no problem in FF3 or Safari/windows)
the error is on the last line of this function in dojox.grid._View

buildRowContent: function(inRowIndex, inRowNode){
                        inRowNode.innerHTML = this.content.generateHtml(inRowIndex, inRowIndex);
                        if(this.flexCells){
                                // FIXME: accessing firstChild here breaks encapsulation
                                inRowNode.firstChild.style.width = this.contentWidth;
                        }
                },

The 'this' is a valid object, however, it does not have
contentWidth
attribute

I am usuing 8/24 version of SVN trunk.
I am thinking it is a bug... but not sure... because it does not error out in FF or Safari

The sample code is:

<table style="font-size:auto;" id="grid"
dojoType="dojox.grid.DataGrid" jsId="grid" rowSelector="20px"
>

<script type="dojo/method">               

                        data = {
                identifier: 'col_1',
                label: 'col_1',
                items: []
        };
        data_list = [
                { col1: "normal", col2: false, col3: "new", col4: 'But are not followed by two hexadecimal', col5: 29.91, col6: 10, col7: false },
                { col1: "important", col2: false, col3: "new", col4: 'Because a % sign always indicates', col5: 9.33, col6: -5, col7: false },
                { col1: "important", col2: false, col3: "read", col4: 'Signs can be selectively', col5: 19.34, col6: 0, col7: true },
                { col1: "note", col2: false, col3: "read", col4: 'However the reserved characters', col5: 15.63, col6: 0, col7: true },
                { col1: "normal", col2: false, col3: "replied", col4: 'It is therefore necessary', col5: 24.22, col6: 5.50, col7: true },
                { col1: "important", col2: false, col3: "replied", col4: 'To problems of corruption by', col5: 9.12, col6: -3, col7: true },
                { col1: "note", col2: false, col3: "replied", col4: 'Which would simply be awkward in', col5: 12.15, col6: -4, col7: false }
        ];
        var rows = 4;
        for(var i=0, l=data_list.length; i<rows; i++){
                data.items.push(dojo.mixin({ col_1: i }, data_list[i%l]));
        }
        // global var "test_store"
        test_store = new dojo.data.ItemFileWriteStore({data: data});

                        gridLayout = {
                                defaultCell: { width: 8, editable: true, styles: 'text-align: right;'  },
                                cells: [
                                        { name: 'Id', width: 3, field: 'col_1' },
                                        { name: 'Priority', field: 'col1', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: ["normal", "note", "important"]},
                                        { name: 'Mark', field: 'col2', width: 3, styles: 'text-align: center;', type: dojox.grid.cells.Bool },
                                        { name: 'Status', field: 'col3', styles: 'text-align: center;', type: dojox.grid.cells.Select, options: [ "new", "read", "replied" ]},
                                        { name: 'Message', field: 'col4', styles: '', width: '100%' },
                                        { name: 'Amount', field: 'col5'}
                                ]
                        };
                        //store has to go before the layout
                        this.setStore(test_store);
                        this.setStructure(gridLayout);
                       
</script>
</table>

I am facing the same problem

I am facing the same problem tooo................ with IE 6.0. At exactly same line you mentioned above. Thanks for posting. Also grid.filter() method not working. meaning the grid doesn't paint on IE 6.0. no errors...........

Man this is so true - http://www.gosquared.com/liquidicity/wp-content/uploads/2007/05/lq_how_t...

Well .. I tried to figure

Well .. I tried to figure out a workaround, but could not.
(as it fails in more than one place)

so, submitted a ticket on this

http://bugs.dojotoolkit.org/ticket/7559

I agree that something is horribly wrong with IE7 -- it seems like even though dijit does not support Opera, for example
but it works much better in my experience than IE7 .

Long shot

Try declaring a variable with an empty structure

var _defaultDataGridStructure = [];

in your grid definition add structure="_defaultDataGridStructure"

<table style="font-size:auto;" id="grid" dojoType="dojox.grid.DataGrid" jsId="grid" rowSelector="20px" structure="_defaultDataGridStructure">

an update: In 1.2 Beta 2 I

an update:

In 1.2 Beta 2 I can use setStructure from within Dojo method even before the setStore is called
it works on IE7, FF3, Opera 9.52 and Safari.