Checkboxes that activate input number on DataTable
Checkboxes that activate input number on DataTable
muhamadyuraz07
Posts: 8Questions: 3Answers: 0
I'm creating a table of products and when i click on the checkbox it is supposed to enable an input that is in the same tr as the selected checkbox. Is there a way I can do that ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you using the Datatables Editor?
Or are you wanting to create your own editing code?
Kevin
I'm not using Datatables editor.
Plus what I'm trying to create is a table of products that when I select a checkbox in a row the input of the quantities is enabled. and then as I change the quantities of that product it sums and shows the result at some span.
But yet I'm getting a problem, all works well on the first page but when I change the page it overrides all content and the sum.
The best thing to do is provide a link to your page or a test case so we can see what you are doing and offer suggestions.
Note that when using Datatables the only rows in the DOM are the rows being displayed. If you are displaying 10 rows at a time but have 100 in the table the DOM only contains 10 rows. You will need to use Datatables APIs to update the data and to sum the data.
Kevin
PS: How do i use the API and where do i find it?
The API's are documented here:
https://datatables.net/reference/api/
I suspect part of the problem is that Datatables doesn't know about the input changes. This thread that I just answered has the same issue. See example I provided for help with this part.
If you still need help please provide a running test case showing the issue. Thats a lot of code to study to try understanding what is happening without actually seeing it run.
Kevin
Thanks