Skip to content

M2.2.0 Admin Grid column ordering/positioning not working when single store mode set On #12070

@gwharton

Description

@gwharton

Preconditions

  1. Magento 2.2.0, no special setup
  2. Installed as defaults, just one store/website.

Steps to reproduce

  1. Set single store mode to no.
  2. Clear Cache
  3. TRUNCATE ui_bookmark table
  4. Go to sales order grid
  5. Move Status column close to start of table
  6. Refresh Sales order grid
  7. Sales order grid should be presented with the same column ordering with Status column close to start of table
  8. Confirm in MYSQL ui_bookmark table that the "current" bookmark for sales order grid contains "positions" data
  9. Change single store mode to yes
  10. Clear Cache
  11. TRUNCATE ui_bookmark table
  12. Go to sales order grid
  13. Move Status column close to start of table
  14. Refresh Sales order grid
  15. Sales order grid does not remember column ordering
  16. Confirm in MYSQL ui_bookmark table that the "current" bookmark for sales order grid does not contain "positions" data

INITIAL FINDINGS

When Magento creates an admin grid, it calls

Magento_Ui/js/grid/listing.js::initElement($item)

for each column in the grid.

This function calculates totalCount to be the total number of columns available to be added and currentCount to be the current number of columns added. currentCount increases as each column is added, until currentCount==totalCount at which point it triggers the call to enable and apply positioning data for the columns, as as far as it knows, all columns have now been added.

When single store mode is set to yes the "Purchase Point" column is hidden and cannot be selected, however the value of totalCount in the above function still includes the Purchase Point column. When the columns are added to the grid, the purchase point column is skipped and we reach the situation that we never get to the point of currentCount==totalCount and the positioning calls are never called. We always fall 1 column short of triggering the positioning calls.

Effectively we have

Single Store mode = yes
Visible columns = 19
totalCount = 20
Columns added to grid = 19
Positioning is not triggered as currentCount never reaches totalCount

Single Store mode = no
Visible columns = 20
totalCount = 20
Columns added to grid = 20
Positioning is triggered

Metadata

Metadata

Assignees

Labels

Event: balance-cdFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions