简体   繁体   English

jquery.datatables.editable-突出显示选定的行

[英]jquery.datatables.editable - highlight selected row

I'm new to JS. 我是JS的新手。 How can i highlight selected row when user clicked on it at editable datatable? 当用户在可编辑数据表上单击所选行时,如何突出显示该行?

Thank you. 谢谢。

If you are using the jquery datatable plugin, there is an example here : http://datatables.net/release-datatables/examples/api/select_row.html 如果您使用的是jQuery datatable插件,则此处有一个示例: http : //datatables.net/release-datatables/examples/api/select_row.html

$(document).ready(function() {
    /* Add/remove class to a row when clicked on */
    $('#example tr').click( function() {
        $(this).toggleClass('row_selected');
    } );

    /* Init the table */
    var oTable = $('#example').dataTable( );
} );

/*
 * I don't actually use this here, but it is provided as it might be useful and demonstrates
 * getting the TR nodes from DataTables
 */
function fnGetSelected( oTableLocal )
{
    return oTableLocal.$('tr.row_selected');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM