jQuery UI Widgets Forums Grid Problem with cell formatting

This topic contains 2 replies, has 2 voices, and was last updated by  Dimitar 9 years, 12 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Problem with cell formatting #50178

    wfr
    Participant

    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

    Problem with cell formatting #50179

    wfr
    Participant

    Ah, I just noticed, the changes only apply after editing.

    Problem with cell formatting #50201

    Dimitar
    Participant

    Hello wfr,

    You should also set the type of your datafields, i.e.:

    datafields: [
    { name: 'datum', type: 'date' },
    ...

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.