Select extension 'dselect' event not working

Select extension 'dselect' event not working

dropdxdropdx Posts: 3Questions: 2Answers: 0
edited December 2020 in Free community support

Description of problem:

I'm using the Select extension, and the 'select' event works, but the 'dselect' event isn't working.

app = {
    searchResultsDataTable: null
};

$.ajax({
    type: 'GET',
    url: url,
    data: data,
    dataType: 'json',
    success: function (data) {
 
        app.searchResultsDataTable = $('#searchResultsDataTable').DataTable({
            data: data,
            paging: true,
            lengthMenu: [
                [6, -1],
                [6, 'All'],
            ],
            info: false,
            searching: true,
            destroy: true,
            autoWidth: false,
            bSort: false,
            select: 'single',
            columns: [
                { title: 'XXX' }
            ],
        });

        app.searchResultsDataTable.on('select', function (e, dt, type, indexes) {
            console.log('SELECT', e, dt, type, indexes);
        });

        app.searchResultsDataTable.on('dselect', function (e, dt, type, indexes) {
            console.log('DSELECT', e, dt, type, indexes);
        });

    }
});

What I'm expecting to happen is when I click on a row the 'select' event would fire, and then if I click that same row again and it's un-highlighted, then the 'dselect' even would fire. Is this correct?

Like I said the 'select' event is working. Is my understanding of the 'dselect' even incorrect?

Thanks

Answers

  • dropdxdropdx Posts: 3Questions: 2Answers: 0

    So, this was a dumb mistake. I could have sworn the event was just 'dselect' instead of 'deselect' - I even checked multiple times. I think my eyes played tricks on me.

    Changed to 'deselect' and it's working...

This discussion has been closed.