2016-09-21 61 views
0

在我的table如果我點擊表頭數據將被排序。該標題中有複選框,當我點擊標題標題時,複選框也會被點擊。當我點擊標題標題時,我只想做這種工作。只點擊表標題標題

my table

這是表頭的代碼。

<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> 
+0

提供排序代碼或任何可能有助於解決問題的代碼 – madalinivascu

+1

@ madalin ivascu找到答案謝謝你的努力。 –

回答

1

我覺得問題是Propagation。 在你的jQuery函數中使用這段代碼。

event.stopPropagation(); 

閱讀this爲您的額外知識。 乾杯。

+1

我該如何使用這個? –

+1

@SunethSenanayake:您可以簡單地將表添加到表頭並在jQuery中單擊事件編寫代碼。然後您可以使用this.Understacked? –

+1

非常感謝它的工作。 –