take subtable item
take subtable item
silens
Posts: 101Questions: 40Answers: 0
I have a subtable in which I can take the value of id in this way, but if I hide the value of id, it does not work anymore
how can I access a value of a row in a subtable or daughter table
$('table').off('click', 'button.TareaH');
$('table').on('click', 'button.TareaH', function () {
idT = $(this).parent().siblings('td:first').text();
});
Gracias
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @silens ,
We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I need to get a value from the subtable column by clicking on a row.
Es un ejemplo como este.
https://datatables.net/examples/api/row_details.html
Hi @silens,
Something like this will get the middle row (item 1) of the children.
Cheers,
Colin
Muchas gracias por ayudarme, no he podido hacer uso de su código.
Mi problema es que al hacer click sobre un tr de historia, tambien hace click sobre el tr de la tabla hija tarea de historia. Como podría diferenciarlos?
Tabla principal Historias
Tabla hija
Me es imposible representar en consola este código.
I'm not sure I fully understand (a test case as Colin asked for would be useful), but it sounds like event bubbling is the issue here. Using
event.stopPropagation()
would help resolve that.Allan
Hi @silens ,
You would differentiate between them by the class name - in your example you're adding class 'shown', so as in my example, you can use that as part of the jQuery selector to tell if it's a child or the parent. Likewise, there are other classes that only belong to the parent if you want an event listener only for those rows,
Cheers,
Colin
Muchisimas gracias, lo he solucionado con la función event.stopPropagation()