or
public class ShrinkCoeffModel
{
[Display(Name = "thickness")]
public virtual int Thickness { get; set; }
[Display(Name = "wett")]
public virtual string[] Wetness { get; set; }
[Display(Name = "coeff")]
public virtual decimal[] Coeff { get; set; }
}
@(
Html.Kendo().Grid(Model)
.Name("ShrinkCoeff")
.ToolBar(commands =>
{
commands.Create();
})
.Columns(columns =>
{
columns.Bound(o => o.Thickness);
for (int i = 0; i <
Model.FirstOrDefault
().Wetness.Count(); i++)
{
columns.Bound(o => o.Wetness[i]);
}
columns.Command(command =>
{
command.Edit();
command.Destroy();
}).Width(210).Title("Действия");
})
.Editable(editable => editable.TemplateName("Item").Mode(GridEditMode.PopUp))
.DataSource(dataBinding => dataBinding
.Server()
.Model(model => model.Id(o => o.Thickness))
.Update("Edit", "ShrinkCoeff")
.Create("Create", "ShrinkCoeff")
.Destroy("Delete", "ShrinkCoeff"))
.Pageable()
.Sortable()
.Selectable()
)
@model Maris.Presentation.Models.EventSummary.EventSummaryMasterViewModel
@{
ViewBag.Title = "Event Summary";
}
@(Html.Kendo().Grid(Model.Data)
.Name("EventSummary")
.DataSource(dataSource => dataSource
.Server()
.PageSize(20)
)
.CellAction(cell =>
{
if (cell.Column.Title.Equals("Name"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.VesselNameBackColor, cell.DataItem.VesselNameForeColor);
}
else if (cell.Column.Title.Equals("Type"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.VesselTypeBackColor, cell.DataItem.VesselTypeForeColor);
}
else if (cell.Column.Title.Equals("Arrival<
br
>Time"))
{
cell.HtmlAttributes["style"] = String.Format("color: {0}",
cell.DataItem.ArrivalTimeForeColor);
}
else if (cell.Column.Title.Equals("Departure<
br
>Time"))
{
cell.HtmlAttributes["style"] = String.Format("color: {0}",
cell.DataItem.ArrivalTimeForeColor);
}
else if (cell.Column.Title.Equals("Arrival<
br
>Date"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.ArrivalBackColor, cell.DataItem.ArrivalForeColor);
}
else if (cell.Column.Title.Equals("Departure<
br
>Date"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.DepartureBackColor, cell.DataItem.DepartureForeColor);
}
else if (cell.Column.Title.Equals("Current<
br
>Berth"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.CurrentBerthBackColor, cell.DataItem.CurrentBerthForeColor);
}
else if (cell.Column.Title.Equals("Current<
br
>Activity"))
{
cell.HtmlAttributes["style"] = String.Format("background-color: {0}; color: {1}",
cell.DataItem.CurrentActivityBackColor, cell.DataItem.CurrentActivityForeColor);
}
})
.Columns(columns =>
{
columns.Bound(d => d.Status);
columns.Bound(d => d.Updated);
columns.Bound(d => d.Quarantine);
columns.Bound(d => d.Name);
columns.Bound(d => d.Num);
columns.Bound(d => d.Agent);
columns.Bound(d => d.Type);
columns.Bound(d => d.Flag);
columns.Bound(d => d.CallSign);
columns.Bound(d => d.MMSI);
columns.Bound(d => d.Announce);
columns.Bound(d => d.ArrivalDate)
.Format("{0:MM/dd/yyyy}")
.Title("Arrival<
br
>Date");
columns.Bound(d => d.ArrivalTime)
.Format("{0:HH:mm}")
.Title("Arrival<
br
>Time");
columns.Bound(d => d.DepartureDate)
.Format("{0:MM/dd/yyyy}")
.Title("Departure<
br
>Date");
columns.Bound(d => d.DepartureTime)
.Format("{0:HH:mm}")
.Title("Departure<
br
>Time");
columns.Bound(d => d.CurrentBerth)
.Title("Current<
br
>Berth");
columns.Bound(d => d.CurrentActivity)
.Title("Current<
br
>Activity");
})
.Pageable(paging => paging
.Refresh(true)
.PreviousNext(true)
.PageSizes(new []{ 20, 40, 80, 100 })
.Input(true)
)
.Groupable()
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn))
//.HtmlAttributes(new { style = "height:100%" })
//.Scrollable()
.Filterable()
.ColumnMenu()
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
)