angular-gridster2 icon indicating copy to clipboard operation
angular-gridster2 copied to clipboard

Is there any way to handle when auto position item fails?

Open FaridAhamat opened this issue 3 years ago • 0 comments

I'm looking at autoPositionItem():

autoPositionItem(itemComponent) {
        if (this.getNextPossiblePosition(itemComponent.$item)) {
            // yada yada
        }
        else {
            itemComponent.notPlaced = true;
            if (!this.$options.disableWarnings) {
                console.warn('Can\'t be placed in the bounds of the dashboard!/n' +
                    JSON.stringify(itemComponent.item, ['cols', 'rows', 'x', 'y']));
            }
        }
    }

The default behavior as it its now works great, I don't mind it auto position the items for me. But when user adds more item and it fails, I would like to be able to handle it - like show an alert or something.

I can hack around to detect console.warn, but I also would like to disable the warnings at production, so I can't detect the console.warn then.

FaridAhamat avatar Oct 16 '21 03:10 FaridAhamat