Using columns.render in Service Implementation to link data.

Using columns.render in Service Implementation to link data.

abergsabergs Posts: 2Questions: 2Answers: 0
edited February 2017 in Free community support

UPDATE: I was expecting the render to be in columnDefs like the JavaScript implementation. It actually goes in the getColumns() method:

protected function getColumns()
{
    return [
         'id'=> [
              'data'=>null,
              'render'=>"function(){ return full['id]; }", //return whatever you want, URL, etc.
         ],
    ];
}

In the service implementation, how do you use the columns.render method to render the data as a URL?

In the traditional implementation you can call the columnDefs using JavaScript:

"render": function ( data, type, full, meta ) {
      return '<a href="'+data+'">Download</a>';

So I'm looking for the syntax for rendering that data from my PHP controller using the service implementation.

I know this isn't correct, but I'm currently trying to use something like this from within the getBuilderParameters() method:

return [
     'select' => true,
     'columnDefs' => [
          'targets' => 0, //This targets correctly
          'visible' => true, //I can set this to false and it hides the column, so I know I'm at least partially there.
          'data' => null,
          'render' => [ 
              //Need Code
          ],
  
     ]
];
This discussion has been closed.