Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81910

Combining a URL with ID

$
0
0

How to do

MY Codes:

var editor; // use a global for the submit and return data rendering in the examples

$(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
        "ajax": "staff.php",
        "table": "#example",
        "fields": [ {
                label: "First name:",
                name: "first_name"
            }, {
                label: "Last name:",
                name: "last_name"
            }, {
                label: "Position:",
                name: "position"
            }, {
                label: "Office:",
                name: "office"
            }, {
                label: "Extension:",
                name: "extn"
            }, {
                label: "Start date:",
                name: "start_date",
                type: "datetime",
                def:   function () { return new Date(); },
                format: 'DD.MM.YYYY HH:mm'
            }, {
                label: "Salary:",
                name: "salary"
            }
        ]
    } );


    var table = $('#example').DataTable( {
        lengthChange: false,
        ajax: {
            url: "xxx.php",
            type: "POST"
        },
        dom: "<'row'<'col-sm-6'><'col-sm-6'f>>" +"<'row'<'col-sm-12'tr>>" +"<'row'<'col-sm-5'li><'col-sm-7'p>>",
        processing: true,
        serverSide: true,
        columns: [
            { data: "first_name" },
            { data: "last_name" },
            { data: "position" },
            { data: "office" },
            { data: "start_date"},
            { data: "salary", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: true,

1rd try :/

"columnDefs": [ {
    "targets": 1,
    "data": "first_name",
    "render": function ( data, type, row, meta ) {
      return '<a href="URL\test.php?ID='+data.ID+'">'+data+'</a>';     }
 }
]

this is returning http://URL/test.php?ID=undefined

2rd try :(

"columnDefs": [ {
    "targets": 1,
    "data": "first_name",
    "render": function ( data, type, row, meta ) {
      return '<a href="URL\test.php?ID='+data.RowID+'">'+data+'</a>';     }
 }
]

this is returning http://URL/test.php?ID=undefined

3rd try :s

"columnDefs": [ {
    "targets": 1,
    "data": "first_name",
    "render": function ( data, type, row, meta ) {
      return '<a href="URL\test.php?ID='+data.DT_RowID+'">'+data+'</a>';     }
 }
]

this is returning http://URL/test.php?ID=undefined

4rd try :'(

"columnDefs": [ {
    "targets": 1,
    "data": "id",
    "render": function ( data, type, row, meta ) {
      return '<a href="URL\test.php?ID='+data+'">'+data+'</a>';     }
 }
]

this is returning http://URL/test.php?ID=undefined


Viewing all articles
Browse latest Browse all 81910

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>