In JS
I have the following code:
$('#botones').html('<button type="button" class="btn btn-success hvr-float-shadow pull-right" style="position: relative; bottom: 3px; border-radius: 20px;background: teal; border-color: teal;" onclick="LoadDataEvaluados()"> Evaluado </button>'
+ '<button type="button" class="btn btn-danger hvr-float-shadow pull-right" style="position: relative; bottom: 3px;right: 20px; border-radius: 20px;" onclick="LoadDataNoEvaluados()">No Evaluado</button>');
As you can see, each botón
has a onclick
that corresponds to funciones diferentes
, the idea is that depending on each función
, a column can be added or removed from a table...
HTML
<tr>
<th>ID</th>
<th>Cédula</th>
<th>Nombre</th>
<th>Apellido</th>
<th>resultados</th>
</tr>
(Esta tabla se encuentra en el html)
That is to say that when you press the one that in this botón 'evaluados'
case contains it , función LoadDataEvaluados();
you can add it below the label or column, otherwise it does not show<th>resultados<th>
<th>detalle<th>
<th>detalle<th>
I would appreciate the interest. (I couldn't try to hide that column as the datatables would throw an error.)
To add elements use the append method and to remove them the remove .
Note that in the following example I only add and remove the header, in practice you should do it with the cells of all the rows. Using jQuery selectors you shouldn't have a problem.
Well, I think what you want is for it not to be hidden, and just not to be written to the document. Well, I would do it in the following way:
Validate with this please. Cheers
http://www.cubicfactory.com/jseditor/
HTML
JAVA SCRIPT
---------------this is the css
There are two ways
document.createElement("label"); where "label" will be the name of the label you use
Variable.innerHTML; you can add a full text with innerHTML directly to your page, but the changes made will not be captured inside the js, you know? In short, you add the elements, more functionality will not be so easy to deal with.
Luck
This is an example Hiding / Showing the Results header using the datatanbles.net library, but first I put it in
<thead>
the table like this:Now in the plugin declaration I have left it like this:
In the functions of the buttons I have put the following:
functional example
This example does what you want but won't let you sort them