mercredi 8 juin 2016

add dynamic anchor tag to ajax data table in laravel 5.1

Generally we will be adding dynamic anchor tag from ajax data table by using the following code.

 $('#example').DataTable({
            "ajax": yourDataURL,
            "columns": [ // Defines column for the output table
                    { "data": "InventoryId" }, // Attribute of item in collection
                    { "data": "InventoryName" },
                    { "data": "InventoryManager" },
                    { "data": "InventoryActive1",
                        "orderable": false,
                        "searchable": false,
                        "render": function(data,type,row,meta) { // render event defines the markup of the cell text 
                            var a = '<a href="view.php?comic=' + row.InventoryId + '">' +row.InventoryId + '</a>'; // row object contains the row data
                            return a;
                        }
                    }
            ]
        });

how to add the same when it comes to laravel i was trying that giving error for me

Here is my code

$('#dataTable2').dataTable({

destroy: true,
      aaData: data,
            dom: 'Bfrtip',
        buttons: [
          'excel','copy','pdf'
        ],
    "aoColumns": [
      { "mData": "leadcode" },
      { "mData": "company_name" },
      { "mData": "Eventname" },
      { "mData": "Clientname" },
      { "mData": "Empid" },
     {"render":function(data,type,row,meta) {


        var a = '<a href="">' + row.leadcode + '</a>'; // row object contains the row data
        return a;


}
}


    ]
});

But i am getting no value in the url part giving like this

http://localhost:81/iclock/public/reviewer/sendhotelbookingform/%20%2B%20row.leadcode%20%2B

Can somebody give some idea to solve this ?? Thank You.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire