#7559 closed defect (fixed)
dojox.datagrid fails on IE7 when using .setStructure
Reported by: | vlad | Owned by: | Nathan Toone |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | DojoX Grid | Version: | 1.1.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
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>
Attachments (2)
Change History (11)
Changed 12 years ago by
Attachment: | test_page_html3.html added |
---|
comment:1 Changed 12 years ago by
The problem appears to be more fundamental then just IE7. And the problem is not with setStructure in particular.
The issue is that is impossible to first Programmatically set structure using setStructure, and then programmatically set store using setStore. (Which is natural -- because I first define how my grid looks, and then dynamically hook up a data store to it, later on).
If you call setStore after setStructure (which is 'natural') -- then it fails in setStore on all the browsers -- but on IE7 it appears to fail earlier in the calling sequence...
if you call setStructure after setStore (which is 'unnatural') then it fails in setStructure but only in IE7
in the 'natural' scenario failure happens in the following calling sequence for FireFox3, Safari
_DataGrid.js
_clearData: function(){
this.updateRowCount(0);
--_Grid.js
_Grid._resize
...
this.AdaptWidth?
---
From there on -- I could not quite understand it. It appears that the _Grid calls "adaptWidth" function for every view that belong to the array of viewes
comment:2 Changed 12 years ago by
after more analsys: exiting from _Grid.adaptWidth if rowCount<1 allows Safari and FF3 to call .setStructure .setStore
I think it works because _resize is getting called when a Layout is set but the store has not been set yet or has 0 rows (I am first now setting the grid to a default store with 0 'items' array) So obviously figuring out the dimensions does not work when there is nothing to display except the headers.
IE7 still fails somewhere before adaptWidth... I am still investigating
comment:3 Changed 12 years ago by
Just checked with dojo release 1.2.0b1 and the problem is still there and still the same
I will attach another test file (very similar to my first one)
but the setStructure now takes a variable representing the Grid structure (previous test file was passing as string with the name of the variable but apparently 1.2.0b1 does not support that way anymore)
Changed 12 years ago by
Attachment: | test_page_html4.html added |
---|
a minor change to get the testscanrio to repro on 1..2.0b1
comment:4 Changed 12 years ago by
Milestone: | tbd → 1.3 |
---|
marking these TBD tickets for 1.3 for now, although Bryan may recategorize
comment:5 Changed 12 years ago by
not quite sure, why or what changed but with 1.2 Beta2, I can set structure within dojo/method.
Here is an example <code>
var d=dijit.byId("grid2_id"); var lay = { defaultCell: { width: "10", editable: true, styles: "text-align: right;" },
cells:
[{name: "Column 1", field: "c1"}, {name: "Column 2", field: "c2"}, {name: "Column 3", field: "c3", type: dojox.grid.cells.Select, options: [ "new", "read", "replied" ]}, {name: "Column 4", field: "c4", width: "150px"} ]
}; d.setStructure(lay);
</code>
I use setStore later on in the code (it is done programmatically but not within dojo/method script).
So basically setStructure within dojo/method now works on IE7, FF3, Safari, Opera 9.52
I would like to close the ticket, unless you think otherwise
comment:6 Changed 12 years ago by
Owner: | changed from Bryan Forbes to Nathan Toone |
---|
Reassigning to me
comment:7 Changed 12 years ago by
Milestone: | 1.3 → future |
---|
comment:9 Changed 12 years ago by
Milestone: | future → 1.3 |
---|
batch move of tickets marked 'future' in the 1.3 timeframe
same as the code in the ticket but complete