PDA

View Full Version : [CLOSED] GroupHeaderTpl && date



threewonders
Dec 04, 2014, 10:07 AM
Hello good.

I'm trying to apply a date format to a group and can not.

I have tried the following.




XTemplate tpl = new XTemplate()
{
ID = "XTemplate1"
};

tpl.Html = "<tpl if=\"groupField === 'DueDate'\">" +
"{columnName}: {[Ext.util.Format.date(values.rs[0].data.DueDate, 'Y/m/d')]}" +
"<tpl else>" +
"{columnName}: {name} ({[values.rows.length]} {[values.rows.length > 1 ? 'Tareas' : 'Tarea']})" +
"</tpl>";

Grouping g = new Grouping();
g.GroupHeaderTpl = tpl;


//otherwise

XTemplate tpl = new XTemplate()
{
ID = "XTemplate1"
};

tpl.Html = "<tpl if=\"groupField === 'DueDate'\">" +
"{columnName}: {[Ext.util.Format.date(name, 'Y/m/d')]}" +
"<tpl else>" +
"{columnName}: {name} ({[values.rows.length]} {[values.rows.length > 1 ? 'Tareas' : 'Tarea']})" +
"</tpl>";

Grouping g = new Grouping();
g.GroupHeaderTpl = tpl;






Thank you very much.

threewonders
Dec 04, 2014, 10:32 AM
I auto answer



tpl.Html = "<tpl if=\"groupField === 'DueDate'\">" +
"{columnName}: {[" + TasksGrid.SCOPE + ".renderDate(values.name)]} ({[values.rows.length]} {[values.rows.length > 1 ? \"Tareas\" : \"Tarea\"]})" +
"<tpl else>" +
"{columnName}: {name} ({[values.rows.length]} {[values.rows.length > 1 ? 'Tareas' : 'Tarea']})" +
"</tpl>";

renderDate: function(name) {
return Ext.util.Format.date(name, 'd-m-Y');
},