Skip to content

Replies

0
Michel Lemire
Michel Lemire answered on Jun 15, 2017 8:41 PM

Thank you very much !!!

I want you know how i can call a function inside this template ? 

example :

i want to format my EventDate  like this   [new Date(${EventDate}).toLocalDateString()+new Date(${EventDate}).toLocalTimeString()] 

Or calling a function who return me a formatted string

thx

0
Michel Lemire
Michel Lemire answered on Jun 15, 2017 2:55 PM

Hi,

What wrong in the template of the EventDate Column the cell is always empty

@(Html.Infragistics()
.Grid(Model.CleaningTasks)
.ID("grid1")
.Height("500px")
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.Columns(column =>
{
//column.For(x => x.RecordID).HeaderText("#enregistrement");
column.Unbound("EventDateMonth").HeaderText("Mois").Formula("getEventDateMonth").Format("MMM-yy");
column.For(x => x.HouseNo).HeaderText("Bâtiment d'élevage").Template("<b>${HouseNo}</b>");
column.For(x => x.EventDate).HeaderText("Date d'entrée").Template("{{if ${EventDate} < new Date()}}" +
"<div style='background-color:yellow'>${EventDate}</div>" +
"{{elseif ${EventDate} > new Date()}}" +
"<div style='background-color:green'>${EventDate}</div" +
"{{/if}}"
);

column.For(x => x.LastModificationDate).HeaderText("Dernière modif.").Format("ddd, dd MMM yy HH:mm").FormatterFunction("formatColumn");
})
.Features(features =>
{
features.Sorting().Type(OpType.Local);
features.CellMerging().InitialState(CellMergingInitialState.Merged);
//features.Paging().Type(OpType.Local);
//features.Filtering().Type(OpType.Local);
})
.DataSource((from rec in Model.CleaningTasks
where rec.DetailsType == DetailsTypeEnum.Placed
select rec).AsQueryable())
.DataBind()
.Render()
)