How to use Custom child row renderer and File export in the same Datatables?
How to use Custom child row renderer and File export in the same Datatables?
Watchara
Posts: 30Questions: 5Answers: 1
Here is my javascripts code.
* <script>
* $(document).ready(function () {
* $('#myTable').DataTable({
* "ajax": {
* "url": '@Url.Action("getListIPScanner")',
* "type": "GET",
* "datatype": "json"
* },
* dom: 'Bfrtip',
* buttons: [
* 'copy', 'excel', 'pdf'
* ],
* "columns": [
* { "data": "LocationStockName", "autoWidth": true },
* { "data": "IPAddress", "autoWidth": true },
* { "data": "SerialNumber", "autoWidth": true },
* { "data": "Type", "autoWidth": true },
* { "data": "ModelName", "autoWidth": true },
* { "data": "BrandName", "autoWidth": true },
* { "data": "StatusName", "autoWidth": true },
* { "data": "PlantName", "autoWidth": true },
* { "data": "DepartmentName", "autoWidth": true },
* { "data": "LocationName", "autoWidth": true },
* { "data": "PhaseName", "autoWidth": true },
* { "data": "MachineName", "autoWidth": true },
* ]
* });
* });
* </script>
This discussion has been closed.
Replies
Looks like you've probably got the buttons aspect working, so you just need to use the code shown in this example as a basis for the child rows.
btw there is no
columns.autoWidth
parameter.Allan
This example just fine but I can't search any words in child rows.
It's return no matching records found.
Watchara
The child row content is not controlled by DataTables, so it wouldn't be possible for it to be searchable by the table. Instead you need to have the content you want in a column (even if it is a hidden column).
Allan
This example can search in child row content.
How to apply to my DataTables?
Watchara.
That example does exactly what I noted above - the content of the child rows is contained in the columns of the DataTable.
Allan
It's works! but it's doesn't show a green button.
What's wrong with me? and I've already include all js and css library files.
Watchara
I would need a link to the page to be able to understand why it isn't working as expected.
Allan
Here is my code.
There's are no green buttons.
What some thing wrong with my code?
I don't know how to sent you a link. I just run it on localhost on my PC.
I'm afraid I can't say from the above why it isn't working. I would need a link to the page showing the issue, as I requested above.
Allan
OK. alright. I've solved.
Watchara