Searching on rendered/merged columns...

Searching on rendered/merged columns...

INFJulianINFJulian Posts: 4Questions: 2Answers: 0

Hi, could someone tell me how I can search rendered columns? Here is my code, fairly straight-forward but I'm a little lost - couldn't find anything on it other than columns.render which I'm not sure how to implement.

// DataTable
            var table = $('#dataTable').DataTable({
                "processing": true,
                "serverSide": true,
                "lengthChange": false,
                "pageLength": 50,
                "dom": 'lrtip',
                "ajax": "lib/invoices.php",
                "columns": [
                    { "data": null, render: function ( data, type, row ) { return data.prefix+data.number; } },
                    { "data": 2 },
                    { "data": 3 },
                    { "data": 4 },
                    { "data": null, render: function ( data, type, row ) { return data.total+" "+data.currency; } }
                ]               
            });
        
            // Search
            table.columns().every( function () {
                var that = this.data();
                $( 'input', this.footer() ).on( 'keyup change', function () {
                    that.search( this.value ).draw();
                });
            });

Answers

  • INFJulianINFJulian Posts: 4Questions: 2Answers: 0

    Is there perhaps an easier way by concatenating the columns in the source php file? How would I do that?

This discussion has been closed.