or
var SchedulerWeekView = kendo.ui.MultiDayView.extend({ options: { selectedDateFormat: "{0:D} - {1:D}" }, nextDate: function () { var startDate = this.startDate(); return new Date(startDate.setDate(startDate.getDate() + 7)); }, previousDate: function () { var endDate = this.endDate(); return new Date(endDate.setDate(endDate.getDate() - 7)); }, name: "SchedulerWeekView", calculateDateRange: function () { var selectedDate = this.options.date, start = kendo.date.dayOfWeek(selectedDate, this.calendarInfo().firstDay, -1), idx, length, dates = []; for (idx = 0, length = 7; idx < length; idx++) { if (start.getDay() <= 5 && start.getDay() > 0) { dates.push(start); } start = kendo.date.nextDay(start); } this._render(dates); } });dataSource: new kendo.data.HierarchicalDataSource({ transport: { read: { url: '/WidgetJson/OrgTree', type: 'POST', dataType: 'json', data: function (currentParams) { var params = {}; params['includeCardAccounts'] = true; return params; } } }, schema: { model: { id: 'OrgId', hasChildren: 'HasChildren', expanded: 'Expanded' } }}),dataTextField: 'OrgDescription'[{"OrgId":46431736,"OrgDescription":"XYZ DEPT Company","HasChildren":true,"Expanded":true}][{"OrgId":46431761,"OrgDescription":"OPExxxxxx - Ixx","HasChildren":true,"Expanded":false},{"OrgId":46431760,"OrgDescription":"OS xxxxxx IBA","HasChildren":true,"Expanded":false},{"OrgId":46431759,"OrgDescription":"ODSxxxxxx- IBx","HasChildren":true,"Expanded":false}][Display(Name = "Days Late"), UIHint("_DaysToDate"), ReadOnly(true)]
public int? DaysLate
{
get; set;
}private static GridBuilder<dynamic> CreateDynamicGrid<TBaseViewModelType>(this HtmlHelper helper, string gridName, string provisioningControllerName, string formActionName = "Edit", bool checkboxRowSelect = false)
{
var type = typeof(TBaseViewModelType);
var modelProperties = type.GetProperties().Where(p => p.IsScaffoldable()).ToList();
var identityProperty = type.GetProperty("Id");
var idFieldName = string.Empty;
if (identityProperty != null)
{
idFieldName = identityProperty.Name;
}
return helper.Kendo().Grid<dynamic>()
.Name(gridName)
.Columns(columns => {
columns.Template(t => t).ClientTemplate("<input class='select-row' type='checkbox' />").HeaderTemplate(t => "<input class='select-all-rows' type='checkbox' />").Width(40).Visible(checkboxRowSelect);
columns.Template(t => t).ClientTemplate(helper.ActionLink(VisionWebResources.Action_More, formActionName, provisioningControllerName, new { id = string.Format("#= {0} #", idFieldName) }, null).ToHtmlString()).Visible(identityProperty != null).Width("4em");
modelProperties.ForEach(p => columns.Bound(p.GetPrevailingType(), p.Name).Format(p.GetFormatString()).HtmlAttributes(p.GetHtmlAttributes()).Width(InitialColumnWidth)); })
.DataSource(ds => ds.Ajax()
.PageSize(15) .Read(r => r.Action("Read", provisioningControllerName))
.Model(model =>
{
model.Id("Id");
foreach (var property in modelProperties) {model.Field(property.Name, property.GetPrevailingType));
}
})
)
.Editable(ed => ed.Enabled(false))
.Events(events => events.DataBound("function() { " +
"if (typeof (gridDataBound) === 'function') { gridDataBound(); }" + "}").Change("function() { " +
"if (typeof (gridFocusedRowChanged) === 'function') { gridFocusedRowChanged(); }" +
"}"))
.Filterable() .HtmlAttributes(new { @class = "grid" })
.Navigatable()
.Pageable(pages =>
{
pages.PageSizes(new[] { 15, 25, 40 });
pages.Refresh(true); //Provides a button to refresh the current grid page
}) .Resizable(resize => resize.Columns(true))
.Scrollable(scrollable => scrollable.Height(425))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Sortable(sortable => sortable.AllowUnsort(false));
}