Opened 5 years ago
Closed 4 years ago
#18847 closed defect (duplicate)
dojox.grid.DataGrid Stop Working in 1.11
Reported by: | activepage | Owned by: | dylan |
---|---|---|---|
Priority: | blocker | Milestone: | 1.11.3 |
Component: | DojoX Grid | Version: | 1.11.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
After upgrade to 1.11 all dojox.grid.DataGrid? in my aplication stop working.
I test in FireFox? and chrome, the tests in dojo don´t work and give me the same result.
All DataGrids? Gray and no item SHOW.
All DataGrids? Gray and no item SHOW.
I Think the problem is related to declare de colluns in HTML, but I´m not SURE. My declarations are iqual to the examples:
<table dojoType="dojox.grid.DataGrid?" class="grid" store="jsonStore" autoHeight="true" query="{ type: 'city' }" rowsPerPage="20" rowSelector="20px">
<thead>
<tr>
<th field="name" width="300px">Country/Continent? Name</th>
<th field="type" width="auto">Type</th>
</tr>
</thead>
</table>
Change History (12)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
Milestone: | tbd → 1.11.2 |
---|---|
Owner: | changed from Evan to dylan |
Priority: | undecided → blocker |
Status: | new → assigned |
Confirmed that these examples are failing silently (but most other examples are working, such as http://download.dojotoolkit.org/release-1.11.1/dojo-release-1.11.1/dojox/grid/tests/test_data_grid_multiStores.html )
comment:3 Changed 5 years ago by
This error appears to be coming from a failure in the jsonStore store loading. In 1.10.5, it loads successfully (data in the jsonStore variable), but the store is empty in master. I'll keep digging to see if I can figure out why the store isn't loading properly.
EDIT: digging a bit further, the store is working properly, but fetch() is not being called in it.
comment:4 Changed 5 years ago by
Milestone: | 1.11.2 → 1.11.3 |
---|
comment:5 Changed 5 years ago by
Indeed, it looks like declaring the columns in <th> tags doesn't work anymore. In test_data_grid_autoheight.html, this produces a grid with 0 columns:
<table dojoType="dojox.grid.DataGrid" class="grid" store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px"> <thead> <tr> <th field="name" width="300px">Country/Continent Name</th> <th field="type" width="auto">Type</th> </tr> </thead> </table>
but replacing it with the following works fine:
<table dojoType="dojox.grid.DataGrid" class="grid" store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px" structure="[{field: 'name', width: '300px', name: 'Country/Continent Name'}, {field: 'type', width: 'auto', name: 'Type'}]"> </table>
comment:6 Changed 4 years ago by
Milestone: | 1.11.3 → 1.13 |
---|
Unfortunately without a PR or patch I'm going to need to move this to 1.13 as I won't have time to look at it before then.
comment:7 Changed 4 years ago by
The problem is in dojo/_base/lang
the "isArray" function used in dojox/grid/_Layout.js
"if(lang.isArray(inStructure)){"
use to return true if structure is an object returned by dojo/query now it returns false
So the method to verify if isArray or not was changed from :
isArray: function(it){ // summary: // Return true if it is an Array. // Does not work on Arrays created in other windows. // it: anything // Item to test. return it && (it instanceof Array || typeof it == "array"); // Boolean },
to
isArray: Array.isArray || function(it){ // summary: // Return true if it is an Array. // it: anything // Item to test. return opts.call(it) == "[object Array]"; // Boolean },
Test case :
<!doctype html> <html> <body> <script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="parseOnLoad:true"></script> <!-- <script src="//ajax.googleapis.com/ajax/libs/dojo/1.11.2/dojo/dojo.js" data-dojo-config="parseOnLoad:true"></script>--> <script> require(['dojo/query', "dojo/_base/lang"], function(query, lang) { console.debug(lang.isArray(query("> colgroup"))); }); </script> </body> </html>
comment:8 Changed 4 years ago by
Ok, then it sounds like this is the same as #18866 which has a PR at https://github.com/dojo/dojox/pull/237/files
comment:9 Changed 4 years ago by
Milestone: | 1.13 → 1.11.3 |
---|
comment:10 Changed 4 years ago by
I don't think is quite the same as it will not pass the first if
if(lang.isArray(inDef)){
the work around will be that the props.structure in the _Grid.markupFactory not to be instantiated from query or lang.isArray to be addapted to return true if object have [0] property
comment:11 Changed 4 years ago by
This was fixed on master via #18844 (see commit: https://github.com/dojo/dojox/commit/74dad0bfeaacbdb1fe0503988da126b8c203cda5)
comment:12 Changed 4 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
I run more test and I can confirm that in the last version of Opera, Firefox and Chrome don´t work. All don´t show the grid. Only a Gray Background.