jqxGrid 绑定格式化

时间:2023-12-09 20:47:49
var cellsrenderer = function(row, columnfield, value, defaulthtml, columnproperties) {
    ) || (row == ) || (row == )) {
        var formattedValue = value;
        if (columnproperties.cellsformat == "yyyy-MM-dd" || columnproperties.columntype == 'datetimeinput') {
            formattedValue = $.jqx.dataFormat.formatdate(formattedValue, columnproperties.cellsformat);
        }
        else if (columnproperties.cellsformat != "") {
            formattedValue = $.jqx.dataFormat.formatnumber(formattedValue, columnproperties.cellsformat);
        }
        return '<div style="height: 100%; background-color: #BBBBBB;"><span style="float: ' + columnproperties.cellsalign + '; position: relative; margin: 4px;">' + formattedValue + '</span></div>';
    };
};
$("#jqxgrid").jqxGrid({
    autoheight: true,
    source: dataAdapter,
    editable: true,
    selectionmode: 'singlecell',
    columns: [
        {
        text: 'First Name',
        datafield: 'firstname',
        width: ,
        cellbeginedit: beginedit,
        cellsrenderer: cellsrenderer},
    {
        text: 'Ship Date',
        datafield: 'date',
        width: ,
        cellsalign: 'right',
        cellsformat: 'yyyy-MM-dd',
        cellbeginedit: beginedit,
        cellsrenderer: cellsrenderer,
        }]
});

jqxGrid 绑定格式化