ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on June 03, 2020, 05:59:59 pm

Title: Prism
Post by: queensgambit9 on June 03, 2020, 05:59:59 pm
Trying to implement prism (prismjs.com) to highligt json data.

Using in render callback:

Code: [Select]
return '<pre class="language-json"><code class="language-json">' + (JSON.stringify(JSON.parse(ui.cellData), null, 2)) + '</code></pre>' } },
But can't get it work...code is displayed but prism class doesn't seem to be applied...do I need to modify it somehow to make it work with grid?

Title: Re: Prism
Post by: paramvir on June 03, 2020, 07:47:30 pm
I presume ui.cellData in your code is json data and not a javascript primitive.

I have no experience of Prismjs.

But looking at its documentation and considering virtual rendering of pqgrid, I guess you may have to use prism programmatically:

Code: [Select]
Prism.highlight( code, Prism.languages.json, 'json');

inside the column.postRender callback of pqgrid.