The problem is very straight forward when using the original code databases
server processing only plain text to page Is displayed on Instead, it pulls properly that what is in the database column in table columns with any additional HTML formatting.
Example: Here is an IMG that looks formatted text HTML
and CSS
. Each column in the table has its own style / format now when datatable
requests a server processing server / database, like I said, just like they are in the database, to see this format , As shown above, I have to put the HTML inside it in the database. IE:
& lt; Span class = "Label label-hazard" & gt; Tag & lt; / Span & gt;
or
& lt; Span class = "label bg-color-green-dark" & gt; Category labels & lt; / Span & gt;
How can I format the results removed from the database and in the table column on the page? I prefer to add the tag to that entire tag instead of just tags in the tag tag.
Does this page have to stop the results before the hit, format it, then post it on the page?
code:
$ (document) .ready (function () {$ ('# example'). Datatale ({"processing": true, "server Side ": true," ajax ":" script / server_processing.php "," column defects ": [{" data ":" first name ", // you should have feedback in this name: JSON" render ": function ( Data, type, complete, meta) {return '& lt; span class = "label label-threat" & gt;' + data + '& lt; / span & gt;'}}}]});}); Use the render
option in the
column, Data: ({"columnDefs": [{"targets": 0, // "column_name" in the column starting with "data"):
, // This name is your JSON response " Render ": function (data, type, complete, meta) {return '& lt; Span class = "label label-danger" & gt; + Data + '& lt; / Span & gt; ';}}]});
Check the documents here:. Use data to match the properties / key of the source object / key. If you are not using any key, then use
target
No comments:
Post a Comment