Watch Pre-recorded Live Shows Here
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Ayesha Fathima
1.9k
178
22.3k
Get whole row data onclick of cell
Feb 7 2018 11:08 PM
Hi,
I have data table onclick of one cell i need to take the whole row data,but it's giving only visible columns data,,How can i get the whole row data??I need to take row data and pass to one function as parameters.
Here it is what i tried,it is giving error like "table.row is not a function",
Sample code
<div
class
=
"panel-body"
>
<table id=
"Getmaildetailstable"
class
=
"table table-striped display"
width=
"100%"
>
<thead>
<tr>
<th></th>
<th>Starredflag</th>
<th>Importantflag</th>
<th>Mailid</th>
<th>Mailbox</th>
<th>LogicalID</th>
<th>Starred</th>
<th>Important</th>
<th>Subject</th>
<th>attachments</th>
<th>mailsize</th>
<th data-date-format=
"yyyymmdd"
>Created On</th>
<th data-date-format=
"yyyymmdd"
>Received On</th>
<th>Difference value</th>
<th>From</th>
<th>Due flag op</th>
<th>To</th>
<th>Read status</th>
<th>Incident_no</th>
<th>classification</th>
<th>Overdue</th>
<th>Attachments</th>
</tr>
</thead>
</table>
</div>
Getmaildetailstable = $(
'#Getmaildetailstable'
).DataTable({
columnDefs: [{
orderable:
false
,
className:
'select-checkbox'
,
defaultContent:
""
,
targets: 0,
visible:
false
}, {
data:
"STARRED_FLAG"
,
defaultContent:
""
,
targets: 1,
visible:
false
},
{
data:
"IMPORTANT_FLAG"
,
defaultContent:
""
,
targets: 2,
visible:
false
}, {
data:
"EMAIL_ID"
,
defaultContent:
""
,
targets: 3,
visible:
false
}, {
data:
"EMAILBOX"
,
defaultContent:
""
,
targets: 4,
visible:
false
}, {
data:
"LOGICAL_ID"
,
defaultContent:
""
,
targets: 5,
visible:
false
}, {
data:
"image"
,render: getStarredflag,
defaultContent:
""
,
targets: 6,
visible:
true
},{
data:
"image"
,render: getImportantflag,
defaultContent:
""
,
targets: 7,
visible:
true
},{
data:
"SUBJECT"
,
defaultContent:
""
,
targets: 8,
"render"
:
function
( data, type, row ) {
return
'<a href="javascript:void(0)">'
+ data +
'</a>'
;
},
visible:
true
},{
data:
"attachments"
,
defaultContent:
""
,
targets: 9,
visible:
false
},{
data:
"MAIL_SIZE"
,
defaultContent:
""
,
targets: 10,
visible:
false
},{
data:
"CREATE_DATE"
,
defaultContent:
""
,
targets: 11,
visible:
true
},{
data:
"RECEIVE_DATE"
,
defaultContent:
""
,
targets: 12,
visible:
false
},{
data:
"flag"
,
defaultContent:
""
,
targets: 13,
visible:
false
},{
data:
"FROM_ADDRESS"
,
defaultContent:
""
,
targets: 14,
visible:
true
},{
data:
"flagday"
,
defaultContent:
""
,
targets: 15,
visible:
false
},{
data:
"TO_ADDRESS"
,
defaultContent:
""
,
targets: 16,
visible:
true
},{
data:
"READ_STATUS"
,
defaultContent:
""
,
targets: 17,
visible:
false
},{
data:
"INCIDENT_NO"
,
defaultContent:
""
,
targets: 18,
visible:
false
},{
data:
"CLASSIFICATION_TYPE"
,
defaultContent:
""
,
targets: 19,
visible:
false
},{
data:
"overdue"
,
defaultContent:
""
,
targets: 20,
visible:
true
},{
data:
"image"
,render: getImg,
defaultContent:
""
,
targets: 21,
visible:
true
}],
select: {
style:
'single'
,
selector:
'td:first-child'
},
order: [
[2,
'asc'
]
],
"searching"
:
false
,
"lengthChange"
:
true
});
$(document).on(
'click'
,
'#Getmaildetailstable tr'
,
function
(e){
var
table = $(
this
);
var
row_object = table.row(
this
).data();
var
mailidrow = table.row(
this
).data()[
'EMAIL_ID'
];
var
mailboxidrow = table.row(
this
).data()[
'EMAILBOX'
];
var
logicalidrow = table.row(
this
).data()[
'LOGICAL_ID'
];
var
subjectrow = table.row(
this
).data()[
'SUBJECT'
];
});
Reply
Answers (
1
)
Give hyperlink on image column in data table
how to Remove highcharts.com text or link from chart