dataTable render not working?
dataTable render not working?
randrews
Posts: 5Questions: 3Answers: 0
Trying to render my datatable as text using " render: $.fn.dataTable.render.text() " to avoid running scripts within the table.
The datatable pulls data from the angularjs scope and runs in the angular controller.
Here is the code to define the datatable:
$scope.dt=angular.element('#allUsers').DataTable({
data: $scope.allUsersDTData
});
How can I get the render to work in the angular controller?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Assuming you can initialise a DataTable like normal, then you should just be able to use
columns.render
like you would in any other environment. Have you tried using it as defined in the documentation?Allan
I'm using the following:
This doesn't throw an error but when the datatable loads with something like "alert(1)" within the data it still runs meaning it throws the alert and doesn't render as text.
Any ideas?
There is no
render
option at the top level of DataTables' configuration options - its in thecolumns
array of configuration options of the columns as shown in thecolumns.render
documentation.Perhaps that isn't clear in the renderer documentation - I'll see about clearing that up.
Allan