如何在Jquery DataTable中获取隐藏字段的值

时间:2014-06-10 12:34:49

标签: asp.net-mvc-4 jquery-datatables

我的代码列在下面

$("#tblAdminUsers").dataTable({
                bProcessing: true,
                sAjaxSource: '@Url.Action("FetchAdminUsers", "Admin")',
                aoColumns: [
                     { sTitle: "Id", bSortable: false, "bVisible": false },
                     { sTitle: "Email", bSortable: false, },
                     { sTitle: "Location", bSortable: false, },
                      { sTitle: "Status", bSortable: true, },
                       { sTitle: "UserType", bSortable: false, },

                     {
                         sTitle: "Actions",
                         bSortable: false,
                         mRender: function (nRow, aData, iDisplayIndex) { return '<i class="ui-tooltip fa fa-pencil actions clsEdit" style="font-size: 22px;" data-original-title="Edit" ></i> <i class="ui-tooltip fa fa-trash-o actions clsDelete" style="font-size: 22px;" data-original-title="Delete"></i>'; }
                     }
                ]

             });

我的问题是,如何在编辑或删除按钮上获取隐藏字段的值(此处为Id)

1 个答案:

答案 0 :(得分:6)

使用数据表1.10:

 var row_that_you_want = 1 //you need to determine this how ever you like
 var table = $('#tblAdminUsers').DataTable()
 var column_data = table.row(row_that_you_want).data()[0]