jQWidgets Forums
jQuery UI Widgets › Forums › Grid › date column from timestamp source
Tagged: cellsformat, column, datafields, date, grid, jquery grid, jqxgrid, timestamp
This topic contains 3 replies, has 2 voices, and was last updated by pedro_prt 9 years, 8 months ago.
-
Author
-
Hi
Is it possible to display a column like ‘dd/MM/yy’ if I have the source in timestamp ?
How should I configure de source type ? And the column properties ?Tks
Pedro Oliveira
Hi Pedro Oliveira,
Please specify the datafield’s type as ‘date’ and set the date column’s cellsformat property to ‘dd/MM/yy’.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar
I allways get ’17/01/70′ on the date (data_vcto) column.
My data has values like ‘1441166400’ (2015-09-02)Grid create function
function grid_502_cpacre_cria(){
$(“#div_502_grid_cpacre”).jqxGrid({
width: 688, height: 360, columnsresize: true, rowsheight: 21, selectionmode: ‘multiplerows’, enablehover: true, sortable: true,
localization: {decimalseparator: “,”, thousandsseparator:”.”, emptydatastring: “”}, theme: ‘energyblue’, scrollbarsize: 12,
columns: [
{text: ‘Cdg’, datafield: ‘cdg_f_parcelas’, width:40, type: ‘float’ },
{text: ‘Data Vcto.’, datafield: ‘data_vcto’, width: ’90px’, cellsformat: ‘dd/MM/yy’},
{text: ‘Conta’, datafield: ‘nome_konta’, width: ‘240px’},
{text: ‘P/R’, datafield: ‘tipo’, width: ’80px’},
{text: ‘Valor’, datafield: ‘valor’, width: ‘100px’, cellsalign: ‘right’, cellsformat: ‘d2’}]
});
}Grid Update function
function fn_grid_502_cpacre_atualiza(result){
if(result.info[0].registros > 0){
var dados = result.dados;
var source =
{
datatype: “json”,
datafields: [
{ name: ‘data_vcto’, type:’date’},
{ name: ‘valor’ },
{ name: ‘saldo’ },
{ name: ‘nome_konta’},
{ name: ‘num_parcela’},
{ name: ‘cdg_f_cpacre’ },
{ name: ‘cdg_f_parcelas’, type: ‘number’ },
{ name: ‘tipo’ },
{ name: ‘valor_baixas’ },
{ name: ‘qtd_baixas’ }
],
localdata: dados
};var dataAdapter = new $.jqx.dataAdapter(source);
$(‘#div_502_grid_cpacre’).jqxGrid({source: dataAdapter});}
}Tks
Pedro OliveiraHi Dimitar
Sorry for keep on this topic, but I think it’s important for other users.
I changed timestamp in seconds to miliseconds and it workedTks
Pedro Oliveira
-
AuthorPosts
You must be logged in to reply to this topic.