user2073077
user2073077

Reputation: 1067

SlickGrid onCellchange

I have a grid in the page that I want to add the onCellchange functionalitiy to, but when I add it it gives me a JS error saying:

oppLineGrid.onCellchange.subscribe(function (e, args) {    
       Uncaught TypeError: Cannot call method 'subscribe' of undefined
            alert('changed');
        });

Here is the code I have, the sort feature is working and I'm thinking that onCellchange is just not being added in the right order. Thanks muchly.

function loadOppLineGrid(data) {
    oppLineGrid = new Slick.Grid("#oppLineGrid", data, oppLineColumns, oppLineOptions);

    oppLineGrid.onCellchange.subscribe(function (e, args) {
        alert('changed');
    });

    oppLineGrid.onSort.subscribe(function (e, args) {
        var cols = args.sortCols;

        oppLineGridData.sort(function (dataRow1, dataRow2) {
            for (var i = 0, l = cols.length; i < l; i++) {
                var field = cols[i].sortCol.field;
                var sign = cols[i].sortAsc ? 1 : -1;
                var value1 = dataRow1[field], value2 = dataRow2[field];
                var result = (value1 == value2 ? 0 : (value1 > value2 ? 1 : -1)) * sign;
                if (result != 0) {
                    return result;
                }
            }
            return 0;
        });
        oppLineGrid.invalidate();
        oppLineGrid.render();
    });
    oppLineGrid.init();

}

Upvotes: 2

Views: 3311

Answers (1)

Fr&#233;d&#233;ric Hamidi
Fr&#233;d&#233;ric Hamidi

Reputation: 263117

Javascript is a case-sensitive language. The event name is onCellChange (capital C):

oppLineGrid.onCellChange.subscribe(function(e, args) {
    alert('changed');
});

Upvotes: 2

Related Questions