我有我的客戶dataTable有五列。一列包含超鏈接。其中一列是複選框。 我想要當用戶點擊行時,該行應該被選中(這意味着行顏色應該改變,並應該選擇複選框 )。我可以用下面的代碼片段做到這一點行選擇行點擊,但沒有超鏈接點擊jQuery數據表中的列之一?
$("#customer").on('click', $.fn.getDataTablesClickHandler("#selectAll"));
//where customer is the html div associated with dataTable and call the same function which gets triggered
//on call of selectAll html element. Inside that function i toggle the class of row
它很好用。但我的問題是我不希望發生這種情況(即行看)在一個列內的鏈接點擊。 我怎麼能做到這一點?所以基本上我怎麼能限制發射getDataTablesClickHandler點擊單元格中的某個鏈接或點擊單元格上的
?
Bryan您的解決方案的最後一行$ .fn.getDataTablesClickHandler(「#selectAll」)。apply(this)does not select the row? –
您需要提供一個HTML示例,以便爲您提供更好的答案,我只是簡單地將它應用到#customer作爲tr的上下文中。您可能能夠擺脫.apply(this) – Bryan