-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions
- Magento 2.2.0, no special setup
- Installed as defaults, just one store/website.
Steps to reproduce
- Set single store mode to no.
- Clear Cache
- TRUNCATE ui_bookmark table
- Go to sales order grid
- Move Status column close to start of table
- Refresh Sales order grid
- Sales order grid should be presented with the same column ordering with Status column close to start of table
- Confirm in MYSQL ui_bookmark table that the "current" bookmark for sales order grid contains "positions" data
- Change single store mode to yes
- Clear Cache
- TRUNCATE ui_bookmark table
- Go to sales order grid
- Move Status column close to start of table
- Refresh Sales order grid
- Sales order grid does not remember column ordering
- 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