Checkbox in searchpane

Checkbox in searchpane

CakeyCakey Posts: 8Questions: 2Answers: 0

Link to test case:
http://live.datatables.net/wiwerite/8/edit

Description of problem:
I have two problems:

Problem 1:
The problem is when I am creating a checkbox, it is also shown in the search pane. Is it possible to only let it show in the datatable and not searchpane?

Problem 2:
How can I change the text for each individ column when the checkbox is ticked?

I am checking for multiple columns and want to be able to change the text when the checkbox is ticked but I can't quite wrap my head around it.

I implemented the multiple checkbox jsfiddle from one of Colins examples from another discussion: http://live.datatables.net/qeheziqo/3/edit
and used it with some my own code example(the same test case as the first):
http://live.datatables.net/wiwerite/8/edit

Answers

  • CakeyCakey Posts: 8Questions: 2Answers: 0

    Since I can't edit I just have to post the same problem down below and hopefully it is a better understanding of my problem :/

    Link to test case:
    Problem - test case 1:
    http://live.datatables.net/wiwerite/9/edit

    Problem - test case 2:
    http://live.datatables.net/wiwerite/8/edit

    Description of problem:
    Sorry for the long text, but the thing is I have two problems and I think they should be under the same topic since they are kinda mixing together and I will try explain my best:

    Problem 1:
    The problem with this example is, when I tick of one of the checkboxes from my test case 1, it ticks off both checkboxes when using this example from datatables:
    https://datatables.net/extensions/select/examples/initialisation/checkbox.html

    I only want the one I selected to be ticked on and off and then it leads to problem 2.

    Problem 2:
    I then created a new function checkbox that I implemented the multiple checkbox jsfiddle from one of Colins examples from another discussion: http://live.datatables.net/qeheziqo/3/edit
    and now I can tick on and off multiple checkboxes without any problem, the only problem for this is, it is also shown in the search pane as you can see in the test case 2.

    Also, is it possible to change the text for each individ column when the checkbox is ticked on and how can I do it?

    I hope my description isn't too confusing, else let me know your comments.

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Cakey ,

    You can hide the checkboxes in the SearchPanes by using orthogonal data - columns.searchPanes.orthogonal take a look at this example. That gets rid of the checkboxes.

    Oddly, that example also seems to fix the issue you are having about both of the checkboxes being selected as well.

    Also, is it possible to change the text for each individ column when the checkbox is ticked on and how can I do it?

    I'm not sure what you mean by this I'm afraid - do you mean change the text within the cells?

    Thanks,
    Sandy

  • CakeyCakey Posts: 8Questions: 2Answers: 0
    edited September 2021

    Hi @sandy ,
    Thank you for the example it worked! :)

    Yes, I have created a test case where the "Name" column is empty.
    Then what I want is when the user has ticked the checkbox on, it''s going to be updated with a text within the cell and as an example it could be "Registered".
    I'm not sure how to do it, but take a look at this test case: http://live.datatables.net/wiwerite/11/edit

    Any idea would be appreciated on how to approach this, thanks again.

  • CakeyCakey Posts: 8Questions: 2Answers: 0

    I was wondering too that when using the test case 2: http://live.datatables.net/wiwerite/8/edit
    I am using the input type 'checkbox'.

    But on test case 1: http://live.datatables.net/wiwerite/9/edit.
    I am using the className: 'select-checkbox' for the dataTables documentation and it seems like a problem to me that the 'select-checkbox' doesn't work correctly as intended when there's more than one checkbox. Shouldn't we be allowed to select only one checkbox to tick on instead of when selecting it is selecting all on the same row even when you only press one checkbox?
    I hope you understand what I am trying to say and it might just be me that handles the code wrong.

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Cakey ,

    Then what I want is when the user has ticked the checkbox on, it''s going to be updated with a text within the cell and as an example it could be "Registered".

    What I would do here is in your listener for the checkbox, make use of the cell().data() api method. You can pass the parent of the checkbox into the cell() call as the selector, and then set the data appropriately if it is checked or not.

    I am using the className: 'select-checkbox' for the dataTables documentation and it seems like a problem to me that the 'select-checkbox' doesn't work correctly as intended when there's more than one checkbox. Shouldn't we be allowed to select only one checkbox to tick on instead of when selecting it is selecting all on the same row even when you only press one checkbox?

    I'm assuming you are referring to this example? That example is specifically for row selection, so it is designed to select the entire row. If you want multiple checkboxes you would have to render them in as you do in your other examples.

    Thanks,
    Sandy

Sign In or Register to comment.