0

Trying to use Yajra DataTables as service implementation and here is my problem:

I have JSON column metas I building table columns based on fields inside that column, for excample:

[ 'data' => 'date', 'name' => 'metas->date AS date', 'title' => 'Data' ],

So inside metas I have:

{
    "date": "2018-09-17",
}

When I try to return this to DataTable it will leave quotas, or escape it with backslash. So the output looks like:

"Something" or "Something \"mmm?\ whatever!" but should be jus Something.

Tried ->escapeColumns(false) and ->rawColumns(['date']) and ->rawColumns(['metas->date']) and many more...

Response looks like this:

{"draw":1,"recordsTotal":77,"recordsFiltered":77,"data":[{"id":43695,"nr":"18-036","date":"\"2018-09-17\""...

As you can see I have additional quotes in response near date: Normally if I return same data from DB with ->toJson() there wouldn't be problem. There is something wrong with DataTables decoding.

2
  • And what is your question? I don't see any, just a description. Commented Oct 1, 2018 at 7:54
  • I have unnecessary quotes in response. Commented Oct 1, 2018 at 7:56

1 Answer 1

0

By default, the Laravel Datable enforce XSS filter. You have to disable it in the column or the whole response.

https://yajrabox.com/docs/laravel-datatables/10.0/xss

Sign up to request clarification or add additional context in comments.

1 Comment

Answer could be improved by including the actual change he should make, rather than just a link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.