General Category > Help for ParamQuery Grid (free version)

Is there a way format a date column inside the colModel?

(1/1)

pbassey:
I have the following colModel definition and I would like the syntax to format the createDate column as mm/dd/yyyy:
    var colModel = [
        { title: "Title", dataType: "string", dataIndx: "title", editable: false, minWidth: '30%', },
        { title: "Content Owner", dataType: "String", dataIndx: "ownerId", editable: false, minWidth: '10%', },
        { title: "Node", dataType: "string", dataIndx: "contentLayout", editable: false, minWidth: '10%', },
        { title: "Type", dataType: "string", dataIndx: "contentType", editable: false, minWidth: '10%', },
        { title: "Status", dataType: "String", dataIndx: "status", editable: false, minWidth: '10%', },
        { title: "Date", dataType: "String", dataIndx: "createdDate", editable: false, minWidth: '20%', }
    ];

paramvir:
Please use column.format property

https://paramquery.com/pro/api#option-column-format

pbassey:
Below is the format command I used, but it seemed to have no effect to the screen output:

        {
            title: "Date", dataType: "String", dataIndx: "createdDate", editable: false, minWidth: '20%',
            format: function (val) {
                return [ 'mm/dd/yyyy'][val];
            }
        }

Can you tell me what I did wrong?

paramvir:
it's simply format: 'mm/dd/yyyy'

Navigation

[0] Message Index

Go to full version