my script transaction.php return following json format
$TransactionSumary[0] = array(
'ExchangeRate' => 'USD = 7,800 | THB 250',
'Total' => '250,000 LAK',
'VAT' => '25,000 LAK',
'GrandTotalUSD' => '15.00',
'GrandTotalTHB' => '1,000',
'GrandTotalLAK' => '<span class="k-block k-success-colored">250,000</span>',
);
echo $_GET['callback']."(".json_encode($TransactionSumary).")";
Please look at GrandTotalLAK
, it contain some HTML tags,
the problem is the GrandTotalLAK
is not display as HTML format property it shown as flat character <span class="k-block k-success-colored">250,000</span>
in Kendo UI Grid,
If I use base64_encode("<span class="k-block k-success-colored">250,000</span>")
, and how to decode it in Kendo UI Grid column properties?
here is the Kendo UI Grid cloumn property
{ field:"GrandTotalLAK", title: "Grand Total (LAK)", width: "20%" },
Thank you very much!
OK after some Google I found solution
<div id="grid"></div> <script> $("#grid").kendoGrid({ columns: [ { field: "name", encoded: false } ], dataSource: [ { name: "<strong>Jane Doe</strong>" } ] }); </script>
rather then passing the html on GrandTotalLak, just pass the value and set the template for that particular columns to how you want to display.
for eg:-
<script id="column_template" type="text/x-kendo-template">
<span class="k-block k-success-colored"> #= GrandTotalLAK #</span>
</script>
then inside the columns of your specific field define the above template id like
template: kendo.template(jQuery("#column_template").html()),
I hope it helpful.
You can tell Kendo Grid not to encode your data using the columns.encoded property - i.e. change your column definition to:
columns: [{
field:"GrandTotalLAK",
title: "Grand Total (LAK)",
width: "20%",
encoded: false
}]
Update: I see you've added that solution to your question - I'll leave my answer here in case anyone else reads too quickly as well!