jQuery datatables add class to tr

后端 未结 5 1777
孤独总比滥情好
孤独总比滥情好 2021-02-01 01:55

I am using jQuery and datatables. I want to add a class to the TR element of a particular row. I know how to find the row. The console.dir(row); shows the r

5条回答
  •  失恋的感觉
    2021-02-01 02:31

    Also you can add class to tr by pass through json data that you send to datatable. It's enough that every json item has DT_RowClass.
    For example:

    {
    
        DT_RowAttr = new
        {
           attr1 = "1",
           attr2 = "2"
        }
        DT_RowClass = "majid",
        DT_RowId = "rowId"
    
    }  
    

    In this example DT_RowId value apply to id attribute of any tr tag and DT_RowAttr value apply some custom attribute to tr tag.

提交回复
热议问题