Problem with render

Problem with render

jmaurinjmaurin Posts: 3Questions: 0Answers: 0

Hi.
I'm trying to use render to display an Image, but it's not working.
My ideia is:
In the field 4, if the field 8 isn't empty, show field 4 + image from field 8.

This is my code:

$(document).ready(function() {
                $('#example').dataTable( {
                    "processing": true,
                    "serverSide": true,
                    "ajax": {
                        "url": "proc_flights.php",
                        "type": "POST"
                    },
                    
                    
                    "columnDefs": [ {
                        "targets": 4,                        
                        "render": function ( data, type, full, meta ) {
                            if (full[8]!='') {                                
                                return '<img src="'+full[8]+'" />';
                            } else {
                                return data;
                            }                              
        
                        }
                      } ]
                    
                    
                    
                } );
            } );

Field 8 are returning 'TAM.png', but my brownser tries to get this URL:

http://radar.jonis.com.br/%27+full%5B8%5D+%27

If I just 'return full[8]', I got 'TAM.png' on my tables (this is correct), so the data is correct.
What I'm doing wrong?
I'm using XHTML.

Tks

Replies

  • jmaurinjmaurin Posts: 3Questions: 0Answers: 0
    edited August 2015

    Also, even using mRender and fixed image (just to text), no image is displayed.
    Here is my table:
    http://radar.jonis.com.br/

     $(document).ready(function() {
                    $('#example').dataTable( {
                        "processing": true,
                        "serverSide": true,
                        "ajax": {
                            "url": "proc_flights.php",
                            "type": "POST"
                        },
                        "columnDefs": [ {                            
                                "mRender": function ( data, type, row ) {
                                    return '<img src="operators/TAM.png" />';
                                },
                                "targets": 4
                        }]
                    } );
                } );
    
  • jmaurinjmaurin Posts: 3Questions: 0Answers: 0

    Solved....just don't use XHTML!

  • allanallan Posts: 63,360Questions: 1Answers: 10,448 Site admin

    How odd - the code you have above should work nicely with XHTML.

    But good to hear you have it working now!

    Allan

This discussion has been closed.