ignore internal html elements on export
ignore internal html elements on export
I have the following problem .. inside th I have span and div(but I only want to export to csv the text of the span(class="col-title") I don't want to export the div or what's inside it
<th scope="col" class="sorting_disabled">
<span class="col-title">Área</span>
<div class="dropdown bootstrap-select>
<select class="selectpicker">
<option value="sección de ingeniería">Sección de Ingeniería</option>
<option value="Área de gestión">Área de Gestión</option>
<option value="Área científica">Área Científica</option>
<option value="Área técnica">Área Técnica</option>
</select>
</div>
</th>
Replies
Use exportOptions.format.body / header / footer like in here for example:
Please, if someone could help me with the regular expression... of this example... because I couldn't solve the problem
If you use
data.replace(/<[^>]*>/g, ' ')
it will extract all the text includingÁrea
and the options likeSección de Ingeniería
. Maybe something like this will work:I did not test this code so it may need some work
It looks for the specific span text. If its found it will set the returned data to the found text. Otherwise it returns the original data.
If you still need help please build a simple test case showing an example of what you have so we can provide more specific suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin