hi have following problem in datatable need show data of each student don´t show date of birth. example
i use mongodb , date of birth in field of type:
isodate 2017-02-28 00:00:00.000z
display date in friendly format use following function:
{ data: "birthdate", title: "bithdate", render:function(val) { var fecha = new date(val); var mes = fecha.getmonth()+1; var anio = fecha.getfullyear(); var dia = fecha.getdate(); var fechaformateada= dia+'/'+mes+'/'+anio; return fechaformateada.tostring(); } }
if don´t use function shows me data follows:
but if search 28 or 2017 not show me result, in top code ::
data.html
<template name="informacion"> <div class="white card" style="padding:10px 10px 10px 10px;"> {{> tabular table=get_information_tabular class="hover nowrap" }} </div> </template>
data.js
my helper
template.informacion.helpers({ get_information_tabular: function(){ return alumnos.tabulartable; } });
attachschema.js
in file have definition of collections , tabular:
alumnos = new orion.collection('alumnos', { singularname: 'alumno', pluralname: 'alumnos', title: 'alumnos', parentpath: '/admin', link: { title: 'alumnos', parent: '_template' }, tabular: { scrollx: true, autowidth:false, responsive:true, limit:5, dom: 'blfrtip', lengthmenu: [ [ 10, 25, 50,100, 500 ], [ '10 filas', '25 filas', '50 filas', '100 filas','500 filas' ] ], buttons: [ { extend:'pagelength', text:"filas" }, { extend: 'copyhtml5', text: 'copiar' } ], columns: [ { data: "birthdate", title: "bithdate", render:function(val) { var fecha = new date(val); var mes = fecha.getmonth()+1; var anio = fecha.getfullyear(); var dia = fecha.getdate(); var fechaformateada= dia+'/'+mes+'/'+anio; return fechaformateada.tostring(); } } ] }});
definition.js
alumnos.attachschema(new simpleschema({ birthdate:{ type: date, label: 'birthdate' ,autoform: { type:"pickadate",pickadateoptions:{ format:'d/m/yyyy', selectmonths: true,selectyears: 100 } } ,optional: true } }));
thanks..
Comments
Post a Comment