Question

I'm trying to remove a column from an aui-datatable but I'm getting a max call stack error.

I'm using AUI for the editable table but it throws a max callstack error exceeded when attempting to remove a column. If I switch back to YUI, by removing the editor and switching aui-datatable to datatable it works fine.

The example I'm working with: http://jsfiddle.net/72Tsf/

var table, applePie, Y, pieList, pieTest;
YUI().use('model', 'aui-datatable', 'datatable-mutable', function (Y) {
    Y.PieModel = Y.Base.create('pieModel', Y.Model, [], {}, {});
    Y.PieList = Y.Base.create('pieList', Y.ModelList, [], {
        model: Y.PieModel
    });       
    pieList = new Y.ModelList({model: Y.PieModel});

    table = new Y.DataTable({
        columns: [
            {key: 'type', editor: new Y.TextCellEditor()}, 
            {key: 'slices'}
        ],
        data: pieList
    });
    table.render();

    applePie = new Y.PieModel({type: 'apple', slices: 1});

    pieList.add(applePie);
    pieList.add(new Y.PieModel({type: 'apple2', slices: 2}));

    pieTest = new Y.Model({});
    pieTest.set('type', 'apple');
    pieList.add(pieTest);

    table.removeColumn(0);
});
Était-ce utile?

La solution

For future reference in case someone else finds this issue:

My actual issue is more complicated than the example I gave but the solution I've found is to remove the table and re-render the table with different headings.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top