Forms in Datatable only send to the server the visible data after filtration

Forms in Datatable only send to the server the visible data after filtration

Kawthar EbrahimKawthar Ebrahim Posts: 1Questions: 1Answers: 0

Hello all,

I am using Datatables with client-side processing inside a simple POST form in ASP.NET Core, one of the Datatable columns is a checkbox where the user can check/uncheck the row and the checkbox list will be sent to the server. I am using the Datatable to simplify the search mechanism and to nicely display the table. As clear from the question title, the values of checkbox list sent is only the one visible the user, for example, if the user checked some data, did a filter after that and submit, only the values in the filtration result will be sent to the server.

I have seen some similar old issues and the suggested solution was to capture all the checked using the DataTables API's in jQuery, in my case, I am not using jQuery for capturing the form result, I am sending to my POST directly. My question here. is there any way or property that can be specified to enable having all the checked checkbox values when sending to the server?

Thanks.

Answers

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    the checkbox list will be sent to the server.

    When you say "checkbox list" do you mean the checkboxes in each row?

    only the one visible the user, for example, if the user checked some data, did a filter after that and submit, only the values in the filtration result will be sent to the server.

    If I understand the question correctly.... Datatables removes all the rows from the DOM except the rows displayed on the page. To access the DOM elements for the rows that are not visible you will need to use rows().nodes().

    is there any way or property that can be specified to enable having all the checked checkbox values when sending to the server?

    Maybe you can post some code that shows what you are doing. Better is a link to your page or a test case showing your workflow.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.