0

I'm trying to select some rows based in Ids stored in a hidden field. There is a column in the boot grid table called Id, and it has the attribute "data-identifier = true". I'm passing the Ids in an array, and the values are correct (I've checked it in the debugger), but the rows aren't selected. What am I doing wrong? I've tried to pass it as a string array and a number array, and nothing seems to work.

            $('td', row).each(function () {
            if (this.className == $('#hdfSelectedShift').val()) {

                if (this.children[1].value != "") {
                    var employeeIds = [];
             employeeIds = this.children[1].value.split(';').map(Number);
                    $('#tableData').bootgrid("select", employeeIds);
                }
                else {
                    $('#tableData').bootgrid("deselect");
                }
            }
        })

With the function shown above, no rows are selected, even though the array contains the ids. Can you guys please help me? If you need any other code, please ask me.

Ruba1
  • 1
  • 5
  • Are you sure selector `$('td', row)` is true ? if you want to select multiple selector do like this `$('td, row')` – muzazu Aug 06 '19 at 13:10
  • Yes. Row is an object, a row from the table where I want to find a specific td (srry for not pointing that). By the way, the function gives me no errors, and i can see the corrects Ids in the employeeIds variable. – Ruba1 Aug 06 '19 at 13:14

1 Answers1

0

I Have managed to solve this by deselecting manually using javascript.

    function deselect() { //função para deselecionar a tabela com employees (ajuste para o bootgrid)
        $('#tableData tbody tr').each(function () {
            this.cells[0].children[0].checked = false;
        })
    }
Ruba1
  • 1
  • 5