samedi 20 juin 2015

Managin Multi Checkbox Matrix With Jquery

I have multi matrix with filled checkboxes. Like in this picture ;

http://ift.tt/1LptIVm

How can I check if one of the checkbox is checked in same line. And only 3 checkboxes can be checked in same row.

For generating this matrix I'm using php. Here is the code ;

<table width="100%" border="1" class="table table-striped" id="listRoomDevice">
    <tbody>
        <tr>
            <th style="font-weight: bold" colspan="3">Devices</th>
            <th style="font-weight: bold" colspan="<?=$roomCount?>">Rooms</th>
        </tr>
        <tr>
            <th style="font-weight: bold">Room Topology</th>
            <th style="font-weight: bold">Device Name</th>
            <th style="font-weight: bold">IP Address</th>
            <? for($i=0; $i < $roomCount; $i++){ ?>
                <th align="center" valign="middle" style="font-weight: bold">
                    <?=$rooms[$i]['LocationName'];?>
                </th>
            <? } ?>
        </tr>
        <?

            $deviceCount = count($getDevice);
            for($j=0; $j < $deviceCount; $j++){
        ?>
            <tr id="tr<?=$getDevice[$j]['DeviceId']?>">
                <th>
                    <select id="devicecount174">
                        <option value="0">Select Device</option>
                        <option value="1">Device A</option>
                        <option value="2">Device B</option>
                        <option value="3">Device C</option>
                    </select>
                </th>
                <th>
                    <?=$getDevice[$j]['DeviceName'];?>
                </th>
                <th>
                    <?=$getDevice[$j]['DeviceIP'];?>
                </th>
                <?php for($k = 0; $k < $roomCount; $k++){ ?>
                    <td align="center" valign="middle">
                        <input type="checkbox" id="map[900][<?=$getDevice[$j]['DeviceId'];?>]"  >
                    </td>
                <? } ?>
            </tr>
        <? } ?>
     </tbody>
</table>  

The problem is I'm not a front-end developer and I didn't have more experience with jquery.

Thanks for the time.

Best Regards...




Aucun commentaire:

Enregistrer un commentaire