Error: [object HTMLDivElement] using datatables.net-responsive-dt
Error: [object HTMLDivElement] using datatables.net-responsive-dt

I am getting [object HTMLDivElement] in mobile view when using slots in responsive mode.
I am getting [object HTMLDivElement] in mobile view when using slots in responsive mode.
Replies
Happy to take a look at a test case showing the issue.
You might need to use the
listHiddenNodes
render.Allan
How to use in React?
This is my current code.
Change
responsive: true
to be:Allan
Hi Allan, I have the same error but when displaying the slots with a Link component, on the desktop screen it is displayed and redirected perfectly, but on the mobile screen the component is not displayed but the ObjectHtmlDivElement error, I am sending you my code, I have used the solution from the previous post but it does not work, in the console it does not detect the renderer property, I hope you can help me, I am new and I am implementing in an inertia-react project
...
const columns = [
{ data: "id" },
{ data: "title" },
{ data: "codigo" },
{ data: "resumen" },
{ data: "precio" },
{ data: "published_at" },
{ data: "id", orderable: false}
];
<DataTable
ajax={route("apiproperty.index")}
columns={columns}
className="display"
scrollX={true}
options={{
select: true,
responsive: true,
}}
slots={{
6: (data) => (
<Link
className="bg-gray-900 text-white px-3 py-2 mx-5"
href={route("property.edit", data)}
>
Edit
</Link>
),
}}
>
<thead>
<tr>
<th>ID</th>
<th>Título</th>
<th>Código</th>
<th>Resumen</th>
<th>Precio</th>
<th>Publicada</th>
<th>Opciones</th>
</tr>
</thead>
</DataTable>
...
Your code above doesn't use the solution given in my previous post in this thread. Try replacing:
With
If that doesn't work for you, then please create a test case showing the issue on StackBltiz, or link to a minimal git repo with instructions on how to build and run it to show the problem.
Allan
Hi Allan, I'm new to React and reviewing the responsive code further, I managed to solve it and provide the solution for someone who is implementing it.
...
options={{
select: true,
responsive: {
details: {
renderer: function(api, rowIdx, columns) {
const datos = api.row(rowIdx).data(); // Obtiene los datos de la fila
console.log("Datos de la fila:", datos); // Verifica los datos recibidos
console.log("datos de columns", columns);
...
Thank you for your attention and I appreciate the great contribution you provide with DataTables-react-net
Sorry to revive an older thread, but I am running into a similar issue.
This is the component I import across my SPA without issues. I have attempted to implement the fix you have listed, however DataTable.Responsive is undefined. Is there an additional configuration step I have missed to inject the Responsive extension into the DataTable itself?
Did you try configuring the
renderer
option asDataTable.Responsive.renderer.listHiddenNodes()
as suggested above?If so, and it still isn't working, can you create a test case on StackBltiz or a minimal git repo showing the issue so I can help to debug it?
Allan
Hi Allan,
I've managed to resolve the issue itself by using $.fn.DataTable.Responsive.renderer instead of DataTable.Responsive.
Having had a read through the source code now, I believe the issue is that Responsive isn't being injected into the DataTable import itself (when used via npm/yarn), only into the jQuery plugin.
I don't have time to create a repro currently, but I will try to get one together for you in the near future.
Thanks for all your work maintaining this site, and for the quick response to the type issue I submitted on GH yesterday.
Tex
$.fn.DataTable.Responsive
andDataTable.Responsive
should be identical. In fact, they should be exactly the same object! If that isn't the case, there is something odd going on with the loader and I'd need to be able to see the project to understand what is happening.Thank you
Allan