question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v8: Custom grid editor control.active is gone

See original GitHub issue

This issue is concerning working with custom grid editors in the backoffice UI where you can no longer see if a grid editor is active in its own controller.

Umbraco version

I am seeing this issue on Umbraco version: 8.4.0

Reproduction

Bug summary

In Umbraco 7, you could know if a grid editor was active by checking for something like:

if ($scope.control.active) { ... }

And by “active” I mean that a user has clicked on a grid editor inside the grid.

The backoffice UI would also itself show a class on the grid editor in grid.html by checking for control.active which would indicate that there existed a boolean property on the control named “active”:

ng-class="{'-active': control.active}"

In Umbraco 8 this property seems to have moved to the controller Umbraco.PropertyEditors.GridController and is being used in grid.html like this:

ng-class="{'-active': control === active}"

Thus it is no longer possible to check for $scope.control.active in the controller of the grid editor, i.e. this no longer works:

<div class="umb-grid-textarea" ng-if="control.active">I am active!</div>

Cause

I am not completely certain, but I found the function clickControl has changed in the aforementioned controller and as you may notice, the property on the control is no longer toggled:

Umbraco 7.15.3:

$scope.clickControl = function (index, controls, cell) {
  controls[index].active = true; // Property toggled here
  cell.hasActiveChild = true;
};

Umbraco 8.4.0:

$scope.clickControl = function (index, controls, cell, $event) {
    $scope.active = controls[index]; // Controller property here instead
    $scope.currentCellWithActiveChild = cell;
    $event.stopPropagation();
};

Actual result

I would expect to be able to see if a control has been activated. Preferably inside the $scope.control method to support backwards compatibility with Umbraco 7.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
johnsharp1975commented, Dec 8, 2020

In the event anyone else stumbles on this post I found a few ways to overcome this change; the easiest of the ways I got to work was:

    .controller("controller", function ($scope) {

        $scope.gridScope = angular.element(document.getElementById('umb-grid')).scope();
        $scope.isActive = function () {
            return $scope.gridScope.active === this.control;
        }

this allows ng-show="isActive()"

HIH someone

1reaction
johnsharp1975commented, Dec 8, 2020

Oh, in terms of why this is useful, I used it to kind of show what the control might resemble when it’s not active and have fields displayed that can be edited when it’s active.

Read more comments on GitHub >

github_iconTop Results From Across the Web

after upgrade grid layout editors not rendering on frontend
Having an issue that the Grid layout is not rending in views. This started after a major upgrade from 7.2.8 to 7.10.
Read more >
Edit Grid and Grid Lines in Edit Mode | User Guide Page
In Curtain Wall Edit mode, the available operations with the Scheme Grid include: •Move or delete a selected Grid Line •Rotate all the...
Read more >
JavaScript Grid - Configuration | DHTMLX Suite 8 Docs
An editor for cells that should contain several options to choose from. There is a possibility to find an option by entering text...
Read more >
Suite8 Miscellaneous Manual V8.9.pdf
The Fidelio V8 Login screen is then displayed. ... Customization functionality is controlled by the user right EDIT under Setup →.
Read more >
QL StageMix V8 User Guide
Please note, it is not possible to edit Custom Fader Bank channel assignments from StageMix. Please use the Console or QL Editor for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found