Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid column state seems improperly handled in setColumnState #851

Closed
remibd opened this issue Apr 21, 2016 · 3 comments
Closed

Invalid column state seems improperly handled in setColumnState #851

remibd opened this issue Apr 21, 2016 · 3 comments

Comments

@remibd
Copy link

remibd commented Apr 21, 2016

Hi!
In the following snippet of code, extracted from dist/ag-grid.js lines 3239 to 3254, the variable oldColumn is sometimes undefined, and oldColumn.setVisible(…) raises an exception:

ColumnController.prototype.setColumnState = function (columnState) {
    var oldColumnList = this.allColumns;
    ...
    if (columnState) {
        columnState.forEach(function (stateItem) {
        var oldColumn = utils_1.Utils.find(oldColumnList, 'colId', stateItem.colId);
        if (!oldColumn) {
            console.warn('ag-grid: column ' + stateItem.colId + ' not found');
            success = false;
        }
        oldColumn.setVisible(!stateItem.hide); // EXCEPTION HERE!
        ...

It looks like it is not the desired behavior, since it might simply cut off the grid generation (and pollutes the console with big flashy red exceptions just after the more tactful console.warn).

Is it the expected behavior?

Thanks in advance

@ceolter
Copy link
Contributor

ceolter commented Apr 26, 2016

code above is wrong, it's actually:

                if (!oldColumn) {
                    console.warn('ag-grid: column ' + stateItem.colId + ' not found');
                    success = false;
                    return;
                }

it you are missing the return statement. maybe you are on an older version, what you describe doesn't happen in the latest.

@ceolter ceolter closed this as completed Apr 26, 2016
@remibd
Copy link
Author

remibd commented Apr 26, 2016

Haven’t you added that return statement yesterday?

@ceolter
Copy link
Contributor

ceolter commented Apr 26, 2016

i released yesterday. i can't remember when i actually added it!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants