Date formatting:
column: date
No matter, what cellsformat I use, it always remains the same standard value (YYYY-MM-DD). I have also included type = ‘date’. The column is defined as ‘date’ in MySQL.
Same for number format. I used the cellsformat ‘f2’ and no change in the data. The corresponding field is defined as float in MySQL as well.
<script>
$(document).ready(function () {
// prepare the data
var source ={
datatype: "json",
datafields: [
{ name: 'datum' },
{ name: 'bank' },
{ name: 'bank_wert' },
{ name: 'zu_an' },
{ name: 'zu_wert' },
{ name: 'info_text' },
{ name: 'info_wert' },
{ name: 'bemerkungen' },
],
url: 'data.php'
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
source: dataAdapter ,
theme: 'classic' ,
width: 600 ,
sortable: 'true' ,
columns: [
{ text: 'Datum', datafield: 'datum', width: 100, type: 'date', cellsformat: 'D' },
{ text: 'Bank', datafield: 'bank', width: 50 },
{ text: 'Bank-Wert', datafield: 'bank_wert', width: 100, type: 'float', cellsformat: 'f2', cellsalign: 'right' },
{ text: 'Zahlung unterwegs an', datafield: 'zu_an', width: 200 },
{ text: 'ZU-Wert', datafield: 'zu_wert', width: 100, type: 'float', cellsformat: 'f2', cellsalign: 'right' }
]
});
});
</script>
Thank you
Walter