Here in the company we are doing a plant management. The apartments / units that have the same end (eg Apt 1, Apt 11, Apt 21) and so on, are one underneath the other in the construction and for that reason the plant attached to them is the same, but if a client ask for customization on your unit, the other's default layout needs to be the same as for customization. We could only use a UPDATE
in the table but I'm doing as I was asked and as we have been asked by the builders even because it might be that the customization is done only on the unit bought by the client and according to what he requested but if the company to decide to change all plants so that the pattern is the same as the custom one, we need to select all of that column to link to.
Each building contains a different amount of units per floor, some contains 4, another 5, and so on, so the amount of columns returned in the table may vary. At the moment, we are only using a function to select all units or no unit but I wanted to know how can you modify my function to select or deselect the units of only one column.
The function is
<script>
function marcardesmarcar(status){
$(".chk").each(
function(){
if ($(".chk").prop("checked"))
$(this).prop("checked", status);
else $(this).prop("checked", status);
}
);
}
</script>'
And the method for showing the checkboxes for each drive is
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($nome_torre_old != $row['nome_torre'] OR
$nome_bloco_old != $row['nome_bloco'] OR
$andar_old != $row['andar']) {
echo '</tr><tr>';
$nome_torre_old = $row['nome_torre'];
$nome_bloco_old = $row['nome_bloco'];
$andar_old = $row['andar'];
}
echo '<td>
<input class="chk" style="margin-left:20px;" type="checkbox" id="p'.$row['id'].'" name="p'.$row['id'].'" ';
if ($row['plt_uni_in_id_unidade']== $row['id'] AND $row['plt_uni_in_id_planta'] == $id_work) echo 'checked="checked"';
echo ' />'.$row['nome_torre'].' '.$row['nome_bloco'].' '.$row['nome_apto'].'</td>';
}
Here the image of how it is, in this case, the building has 4 units per floor and shows 4 columns.
So I wanted to know if there is any way to enter the option to mark / unmark in the header of each column, to be able to check / unselect the options that are in it. In the ways I thought, I need to know in advance how many columns will appear in the table but as I said, each building has a different amount of units per floor so the number of columns will vary. Sorry for the big question but I wanted to explain some things to avoid answers that will not serve me.