Suneth Senanayake Suneth Senanayake - 2 months ago 8
HTML Question

click only table header titel

In my

table
if I click table header data will be sorted. There is checkbox in that header, when I click on header title that checkbox also clicking. I want only working the sort when I click on header title.

my table

This is the table header code.

<thead>
<tr>
<?php if ($folder_id && $sub_folders) { ?>
<th width="2%"><input type="checkbox" id="selectall" class="selected_check"></th>
<?php } ?>
<?php if (isset($sub_folders)) { ?><?php } else { ?>
<th width="5%"></th>
<?php } ?>
<th width="5%"></th>
<th class="vf-icon"></th>
<th ><?php if (isset($sub_folders)) { ?><a href="<?php echo base_url('files/browse') . "/" . $folder_id . "/title"; ?>" style="cursor: pointer;"><?php } else { ?><a href="<?php echo base_url('files/browse') . "/0/title"; ?>" style="cursor: pointer;"><?php } ?>Title</a></th>
<th width="20%" class="text-center"><?php if (isset($sub_folders)) { ?><a href="<?php echo base_url('files/browse') . "/" . $folder_id."/size"; ?>" style="cursor: pointer;"><?php } else { ?><a href="<?php echo base_url('files/browse') . "/0/size"; ?>" style="cursor: pointer;"><?php } ?>Size</a></th>
<th width="20%" class="text-center"><?php if (isset($sub_folders)) { ?><a href="<?php echo base_url('files/browse') . "/" . $folder_id."/last_updated"; ?>" style="cursor: pointer;"><?php } else { ?><a href="<?php echo base_url('files/browse') . "/0/last_updated"; ?>" style="cursor: pointer;"><?php } ?>Last Updated</a></th>
<th width="20%" class="text-center"><?php if (isset($sub_folders)) { ?><a href="<?php echo base_url('files/browse') . "/" . $folder_id."/created_by"; ?>" style="cursor: pointer;"><?php } else { ?><a href="<?php echo base_url('files/browse') . "/0/created_by"; ?>" style="cursor: pointer;"><?php } ?>Created By</a></th>
<th></th>
</tr>
</thead>

Answer

I think the issue is Propagation. use this code in your jQuery function.

event.stopPropagation();

read this for your additional knowladge. Cheers.

Comments