Opened 3 years ago

Closed 3 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.

WORK 1.10.5 https://download.dojotoolkit.org/release-1.10.5/dojo-release-1.10.5/dojox/grid/tests/test_data_grid_autoheight.html

DON'T WORK https://download.dojotoolkit.org/release-1.11.1/dojo-release-1.11.1/dojox/grid/tests/test_data_grid_autoheight.html

All DataGrids? Gray and no item SHOW.

DON'T WORK https://download.dojotoolkit.org/release-1.11.1/dojo-release-1.11.1/dojox/grid/tests/test_data_grid_autowidth.html

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 3 years ago by activepage

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.

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.11.2
Owner: changed from Evan to dylan
Priority: undecidedblocker
Status: newassigned

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 3 years ago by Michael J Van Sickle

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.

Last edited 3 years ago by Michael J Van Sickle (previous) (diff)

comment:4 Changed 3 years ago by dylan

Milestone: 1.11.21.11.3

comment:5 Changed 3 years ago by bsnelderwaard

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 3 years ago by dylan

Milestone: 1.11.31.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 3 years ago by cdabija

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>
Last edited 3 years ago by cdabija (previous) (diff)

comment:8 Changed 3 years ago by dylan

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 3 years ago by dylan

Milestone: 1.131.11.3

comment:10 Changed 3 years ago by cdabija

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 3 years ago by Michael J Van Sickle

comment:12 Changed 3 years ago by Michael J Van Sickle

Resolution: duplicate
Status: assignedclosed
Note: See TracTickets for help on using tickets.