Erro ao usar caixa de seleção na coluna 0 do DataTable usando data.column

Erro ao usar caixa de seleção na coluna 0 do DataTable usando data.column

akatsukiakatsuki Posts: 10Questions: 3Answers: 0

http://live.datatables.net/wobuqoka/2/edit?js**:
**Debugger code (debug.datatables.net)
:

Error messages shown:
**
Tenho um datatable onde eu faço uma requisição ajax para trazer os dados do banco, e estou usando caixa de seleção para marcar e desmarcar os itens. Porém estou com problema para selecionar, quando clico em selecionar somente uma linha, minha caixa de seleção está marcando todos. Segue meu código JS e as bibliotecas que estou usando.
**:

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,736

    Not sure I understand the issue. Your test case doesn't run so its hard to see the problem. You are using the third party plugin Gyrocode checkboxes plugin. If the problem is with the plugin then contact the developer for support of the plugin.

    Please update your test case to demonstrate the problem.

    Kevin

  • akatsukiakatsuki Posts: 10Questions: 3Answers: 0

    eu não conseguir postar correto o caso de teste, pois é um projeto um pouco enorme e tem bastante dependência. Eu postei um print da view onde está o erro consegue ver por favor ? realmente estou usando o checkbox plugin, e usando ele minha tabela esta gerando um erro ao selecionar somente um item. Quando eu clico pra selecionar somente um item acaba selecionando todos, entendeu ?

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,736

    Its difficult to visualize the problem without a running test case. Just seeing the code doesn't help. So I built a test case for you:
    http://live.datatables.net/weqenuto/1/edit

    The problem looks like when selecting a row the select all checkbox is checked. If you look at the Gyrocode examples it shows a dash in the select all checkbox.

    The select all checkbox is from the Gyrocode plugin and not supplied by Datatables. There is a styling issue causing the problem. You will need to ask the plugin developer. Try the Report a bug button on his site.

    Kevin

  • akatsukiakatsuki Posts: 10Questions: 3Answers: 0
    edited November 2021

    eu abrir seu caso de teste é meu erro está exatamente igual seu caso de teste, quando eu clico pra selecionar uma linha, a caixa de seleção acaba marcando todos os checkbox. Eu sei que este erro é devido eu fazer a chamada Ajax e passar o
    "columns": [
    {data: null, defaultContent: ' '},
    { "data": "name" },
    { "data": "position" },
    { "data": "office" },
    { "data": "extn" },
    { "data": "start_date" },
    { "data": "salary" }
    ],
    Se eu remover do trecho do código {data: null, defaultContent: ' '}, meu check simplesmente passa a selecionar somente linha a linha. Porém os dados da coluna Salary desaparece do datatable. Pelo datatable tem alguma documentação de como implelentar um checkbox parecido com o exemplo do plugin Jquery, se souber e mandar a documentação ou um exemplo eu te agradeço. Estou a dias com este problema e não consigo resolver.

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • akatsukiakatsuki Posts: 10Questions: 3Answers: 0

    http://live.datatables.net/weqenuto/3/
    segue este caso de teste como exemplo, está igual meu erro. Quando eu clico no botão para selecionar a linha, acaba selecionando automaticamente o checkbox de cima como se tivesse todos marcados, e isso está causando problemas para mim, conseguiu entender o meu erro ? se puder me ajudar ou passar outra formar de implementar o checkbox do datatable eu agradeço. Obrigado

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    Did you follow Kevin's advice:

    The select all checkbox is from the Gyrocode plugin and not supplied by Datatables. There is a styling issue causing the problem. You will need to ask the plugin developer. Try the Report a bug button on his site.

    ?

  • akatsukiakatsuki Posts: 10Questions: 3Answers: 0

    entendi, mas eu gostaria de algum exemplo de como implementar um checkbox com plugin do datatable. Mas com a opção de marcar e desmarcar todo checkbox. Poderia me mandar um exemplo ou a documentação de algum por favor!

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,736
    edited November 2021 Answer ✓

    The select all checkbox is provided by the Gyrocode plugin. The problem is a styling issue. Its not selecting all the rows. The styling issue will need to be addressed by the developer of the plugin. If you look at the Gyrocode examples you will see the select all checkbox behaves correctly. Please contact the developer for this issue. Provide the test case so he can take a look.

    Datatables doesn't provide a select all checkbox. You can remove the Gyrocode plugin, use this example for the row checkboxes and create your own select all checkbox but there isn't an example. However you might be able to find examples on the forum. I think it would be easier to contact the developer to fix the styling issue.

    Kevin

  • akatsukiakatsuki Posts: 10Questions: 3Answers: 0

    ok, vou fazer isso. muito obrigado pela sua ajuda. tenha um bom dia!

Sign In or Register to comment.