Ayesha Fathima

Ayesha Fathima

  • NA
  • 184
  • 29.7k

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
 
  1. <div class="panel-body">  
  2.                  <table id="Getmaildetailstable" class="table table-striped display" width="100%" >  
  3.                      <thead>  
  4.                         <tr>  
  5.                            <th></th>  
  6.                            <th>Starredflag</th>  
  7.                            <th>Importantflag</th>  
  8.                            <th>Mailid</th>  
  9.                            <th>Mailbox</th>  
  10.                            <th>LogicalID</th>  
  11.                            <th>Starred</th>  
  12.                            <th>Important</th>  
  13.                            <th>Subject</th>  
  14.                            <th>attachments</th>  
  15.                            <th>mailsize</th>  
  16.                            <th data-date-format="yyyymmdd">Created On</th>  
  17.                            <th data-date-format="yyyymmdd">Received On</th>  
  18.                            <th>Difference value</th>  
  19.                            <th>From</th>  
  20.                            <th>Due flag op</th>  
  21.                            <th>To</th>  
  22.                            <th>Read status</th>  
  23.                            <th>Incident_no</th>  
  24.                            <th>classification</th>  
  25.                            <th>Overdue</th>  
  26.                            <th>Attachments</th>  
  27.                         </tr>  
  28.                      </thead>  
  29.                   </table>  
  30.                </div>   
  31.  Getmaildetailstable = $('#Getmaildetailstable').DataTable({  
  32.                  columnDefs: [{  
  33.                      orderable: false,  
  34.                      className: 'select-checkbox',  
  35.                      defaultContent: "",  
  36.                      targets: 0,  
  37.                      visible: false  
  38.                  }, {  
  39.                      data: "STARRED_FLAG",  
  40.                      defaultContent: "",  
  41.                      targets: 1,  
  42.                      visible: false  
  43.                  },   
  44.                  {  
  45.                      data: "IMPORTANT_FLAG",  
  46.                      defaultContent: "",  
  47.                      targets: 2,  
  48.                      visible: false  
  49.                  }, {  
  50.                      data: "EMAIL_ID",  
  51.                      defaultContent: "",  
  52.                      targets: 3,  
  53.                      visible: false  
  54.                  }, {  
  55.                      data: "EMAILBOX",  
  56.                      defaultContent: "",  
  57.                      targets: 4,  
  58.                     visible: false  
  59.                  }, {  
  60.                      data: "LOGICAL_ID",  
  61.                      defaultContent: "",  
  62.                      targets: 5,  
  63.                     visible: false  
  64.                  }, {  
  65.                      data: "image",render: getStarredflag,  
  66.                      defaultContent: "",  
  67.                      targets: 6,  
  68.                     visible: true  
  69.                  },{  
  70.                      data:"image",render: getImportantflag,  
  71.                      defaultContent: "",  
  72.                      targets: 7,  
  73.                     visible: true  
  74.                  },{  
  75.                      data: "SUBJECT",  
  76.                      defaultContent: "",  
  77.                      targets: 8,  
  78.                     "render"function ( data, type, row ) {  
  79.                         return '<a href="javascript:void(0)">' + data + '</a>';  
  80.                       },  
  81.                      visible: true  
  82.                  },{  
  83.                      data: "attachments",  
  84.                      defaultContent: "",  
  85.                      targets: 9,  
  86.                     visible: false  
  87.                  },{  
  88.                      data: "MAIL_SIZE",  
  89.                      defaultContent: "",  
  90.                      targets: 10,  
  91.                     visible: false  
  92.                  },{  
  93.                      data: "CREATE_DATE",  
  94.                      defaultContent: "",  
  95.                      targets: 11,  
  96.                     visible: true  
  97.                  },{  
  98.                      data: "RECEIVE_DATE",  
  99.                      defaultContent: "",  
  100.                      targets: 12,  
  101.                     visible: false  
  102.                  },{  
  103.                      data: "flag",  
  104.                      defaultContent: "",  
  105.                      targets: 13,  
  106.                     visible: false  
  107.                  },{  
  108.                      data: "FROM_ADDRESS",  
  109.                      defaultContent: "",  
  110.                      targets: 14,  
  111.                     visible: true  
  112.                  },{  
  113.                      data: "flagday",  
  114.                      defaultContent: "",  
  115.                      targets: 15,  
  116.                     visible: false  
  117.                  },{  
  118.                      data: "TO_ADDRESS",  
  119.                      defaultContent: "",  
  120.                      targets: 16,  
  121.                     visible: true  
  122.                  },{  
  123.                      data: "READ_STATUS",  
  124.                      defaultContent: "",  
  125.                      targets: 17,  
  126.                     visible: false  
  127.                  },{  
  128.                      data: "INCIDENT_NO",  
  129.                      defaultContent: "",  
  130.                      targets: 18,  
  131.                     visible: false  
  132.                  },{  
  133.                      data: "CLASSIFICATION_TYPE",  
  134.                      defaultContent: "",  
  135.                      targets: 19,  
  136.                     visible: false  
  137.                  },{  
  138.                      data: "overdue",  
  139.                      defaultContent: "",  
  140.                      targets: 20,  
  141.                     visible: true  
  142.                  },{  
  143.                      data: "image",render: getImg,  
  144.                      defaultContent: "",  
  145.                      targets: 21,  
  146.                     visible: true  
  147.                  }],  
  148.                  select: {  
  149.                      style: 'single',  
  150.                      selector: 'td:first-child'  
  151.                  },  
  152.            
  153.                  order: [  
  154.                      [2, 'asc']  
  155.                  ],  
  156.                  "searching"false,  
  157.                  "lengthChange"true  
  158.              });  
  159. $(document).on('click','#Getmaildetailstable tr',function(e){  
  160. var table = $(this);  
  161.     var row_object  = table.row(this).data();  
  162.     var mailidrow         = table.row(this).data()['EMAIL_ID'];  
  163.     var mailboxidrow        = table.row(this).data()['EMAILBOX'];  
  164.     var logicalidrow       = table.row(this).data()['LOGICAL_ID'];  
  165.     var subjectrow        = table.row(this).data()['SUBJECT'];  
  166. });  
 

Answers (1)