Cant select the row when searchPane & Select libraries are added.

Cant select the row when searchPane & Select libraries are added.

alex_g2alex_g2 Posts: 1Questions: 1Answers: 0
edited April 2022 in Free community support

http://live.datatables.net/dijobepu/1/edit?html,css,js,console,output

Hi all,
I am not very good on JS development and I am struggling while trying to select the data form a row.

I am styling my row as cards - they display images with a caption, such as in an image gallery.

When I only have the datatables library loaded, the code in the link above can retrieve the selected row data
''
$(document.getElementById('example')).on('click', 'tr', function (e) {

        var currentTarget = e.currentTarget;
        if(currentTarget && currentTarget.nodeName === "TR")
        {
            var rowIndex = currentTarget._DT_RowIndex;//.rowIndex;


            if((rowIndex !== null) && (rowIndex !== undefined) && !isNaN(rowIndex) && (rowIndex >= 0))
            {
                var table = $(document.getElementById('example')).DataTable();

                var test = table.rows({selected: true});
                var selectedItem = table.rows({
                    selected: true
                }).data()[rowIndex];

              console.log(selectedItem.videoId);

            }
        }


        //console.log(selectedItem)
    });'''

After I added the SearchPane & Select extension libraries, the code no longer works.

I can't tell what is going on, can somebody help?
Any help is hugely appreciated.

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Can you give me a link to a running example showing the error please? I don't immediately see anything from the code shown there that would cause the issue described.

    Allan

Sign In or Register to comment.