Ayesha Fathima

Ayesha Fathima

  • NA
  • 184
  • 29.7k

Add date icon beside date value in data table

Feb 17 2020 2:46 AM
Hi there,
 
I tried to add date icon to table data in Datatable,as per my code icon is getting added down. But I need to show it beside the date.When i tried to add image on render then it is simply showing image but onclick of it it is not showing calender..Onclick of date icon it should show calender.
 
Can someone help ?to add icon beside date and onclick of it need to show calender
 
Here is my code
  1. , {  
  2.                 "targets": 5,  
  3.                 "data""payment_date",  
  4.                 "class""datecell",  
  5.                 "render"function(data) {  
  6.                         if(data!="")  
  7.                         {  
  8.                         var DateArray = isNullData(data).split('T');  
  9.                         var finalDate = DateArray[0];  
  10.                         formateDate = moment(DateArray[0]).local().format("MM/DD/YYYY");   
  11.                         return '<input value="'+  isNullData(formateDate)+'" style="display: inline-block;width: 60%;" class="table-output datecell payment_date_inp form-control" data-toggle="tooltip" data-placement="right" title="'+isNullData(formateDate)+'" /><span style="display: none;">'+isNullData(formateDate)+'</span></div>';  
  12.                         }  
  13.                         else  
  14.                         {  
  15.                         var a=new Date();  
  16.                         formateDate = moment(a[0]).local().format("MM/DD/YYYY");  
  17.                         return '<input value="'+  isNullData(formateDate)+'" style="display: inline-block;width: 60%;" class="table-output datecell payment_date_inp form-control" data-toggle="tooltip" data-placement="right" title="'+isNullData(formateDate)+'" /><span style="display: none;">'+isNullData(formateDate)+'</span></div>';  
  18.                         }  
  19.                         }  
  20.             }  
  1. createdRow: function(row) {  
  2.             //$(".datecell", row).datepicker();   
  3.             $(".datecell", row).datepicker({  
  4.                showOn: 'button',  
  5.                buttonImage: 'images/lookup-date.png',  
  6.                buttonImageOnly: true  
  7.             });  
  8. }  
 

Answers (1)