columns.render hyperlink

columns.render hyperlink

MontereyDeanMontereyDean Posts: 13Questions: 1Answers: 0

Hi! I'm okay creating hyperlinks using:

"columnDefs": [ {
            "targets": 3,
            "render": function ( data, type, full, meta ) {
                return '<a href=\"docs/resolutions/'+data+'\" target=\"_blank\">PDF</a>';
                }
         } ]

"+data+" inserts the file name. But how would I insert the contents of a database column where the hyperlink text -- "PDF" -- is now? For example, "+data+" is the filename and I want to insert the document title, from the database instead of the static "PDF" text.

If the examples on the columns.render page explains this, I just don't understand it.

This question has an accepted answers - jump to answer

Answers

  • MontereyDeanMontereyDean Posts: 13Questions: 1Answers: 0

    Sorry. I probably should have mentioned that I'm using server_processing.php and ssp.class.php scripts.

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin
    Answer ✓

    Is the data you want to display in the JSON returned from the server? If not, then you'd need to add it. If it is (or you add it), use the full parameter to access other data properties from the row.

    Allan

  • MontereyDeanMontereyDean Posts: 13Questions: 1Answers: 0

    I'm not good enough at this yet to understand what you're talking about; so, I'll think of a different way of doing this. But I appreciate your time. Maybe it will help someone a little further along.

This discussion has been closed.