protected override void Serialize(IDictionary <string, object> json) { base.Serialize(json); var idPrefix = "#"; if (!string.IsNullOrEmpty(EventDateTemplate)) { json["eventDateTemplate"] = EventDateTemplate; } if (!string.IsNullOrEmpty(EventDateTemplateId)) { json["eventDateTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventDateTemplateId) }; } if (!string.IsNullOrEmpty(EventTimeTemplate)) { json["eventTimeTemplate"] = EventTimeTemplate; } if (!string.IsNullOrEmpty(EventTimeTemplateId)) { json["eventTimeTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventTimeTemplateId) }; } }
//<< Fields protected override void Serialize(IDictionary<string, object> json) { //>> Serialization if (Confirmation.HasValue) { json["confirmation"] = Confirmation; } if (!string.IsNullOrEmpty(TemplateId)) { json["template"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", TemplateId ) }; } else if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } //<< Serialization }
protected override void Serialize(IDictionary<string, object> json) { base.Serialize(json); if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } if (!string.IsNullOrEmpty(TemplateId)) { var idPrefix = "#"; json["template"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, TemplateId) }; } if (!DisplayDeleteConfirmation) { json["confirmation"] = false; } else if (!string.IsNullOrEmpty(Confirmation) && Confirmation != DefaultConfirmation) { json["confirmation"] = Confirmation; } }
public PivotTransport() : base() { Connection = new PivotTransportConnection(); Discover = new CrudOperation(); FunctionDiscover = new ClientHandlerDescriptor(); }
//<< Fields protected override void Serialize(IDictionary<string, object> json) { //>> Serialization if (!string.IsNullOrEmpty(TemplateId)) { json["template"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", TemplateId ) }; } else if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } if (Text.HasValue()) { json["text"] = Text; } if (Visual != null) { json["visual"] = Visual; } //<< Serialization }
//<< Fields protected override void Serialize(IDictionary<string, object> json) { //>> Serialization if (!string.IsNullOrEmpty(UrlTemplateId)) { json["urlTemplate"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", UrlTemplateId ) }; } else if (!string.IsNullOrEmpty(UrlTemplate)) { json["urlTemplate"] = UrlTemplate; } if (Attribution.HasValue()) { json["attribution"] = Attribution; } if (Opacity.HasValue) { json["opacity"] = Opacity; } //<< Serialization }
private void SerializeContent(Dictionary <string, object> options) { if (ContentUrl.HasValue()) { options["content"] = new Dictionary <string, object>() { { "url", ContentUrl } }; } else if (ContentHandler.HasValue()) { options["content"] = ContentHandler; } else if (!String.IsNullOrEmpty(ContentTemplateId)) { var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } options["content"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, ContentTemplateId) }; } else if (Content.HasValue()) { options["content"] = HttpUtility.UrlDecode(Content); } }
public TransportSignalR() { Hub = new ClientHandlerDescriptor(); Promise = new ClientHandlerDescriptor(); Server = new Dictionary <string, object>(); Client = new Dictionary <string, object>(); }
protected override void Serialize(IDictionary<string, object> json) { base.Serialize(json); var idPrefix = "#"; if (!string.IsNullOrEmpty(EventDateTemplate)) { json["eventDateTemplate"] = EventDateTemplate; } if (!string.IsNullOrEmpty(EventDateTemplateId)) { json["eventDateTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventDateTemplateId) }; } if (!string.IsNullOrEmpty(EventTimeTemplate)) { json["eventTimeTemplate"] = EventTimeTemplate; } if (!string.IsNullOrEmpty(EventTimeTemplateId)) { json["eventTimeTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventTimeTemplateId) }; } }
public Sortable(ViewContext viewContext, IJavaScriptInitializer javaScriptInitializer, ViewDataDictionary viewData) : base(viewContext, javaScriptInitializer, viewData) { CursorOffset = new SortableCursorOffset(); HintHandler = new ClientHandlerDescriptor(); PlaceholderHandler = new ClientHandlerDescriptor(); }
public GridCustomActionCommand() { DataRouteValues = new List <IGridDataKey <T> >(); SendDataKeys = true; SendState = true; Click = new ClientHandlerDescriptor(); }
protected override void Serialize(IDictionary <string, object> json) { base.Serialize(json); if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } if (!string.IsNullOrEmpty(TemplateId)) { var idPrefix = "#"; json["template"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, TemplateId) }; } if (!DisplayDeleteConfirmation) { json["confirmation"] = false; } else if (!string.IsNullOrEmpty(Confirmation) && Confirmation != DefaultConfirmation) { json["confirmation"] = Confirmation; } }
/// <summary> /// Initializes a new instance of the <see cref="ChartAxisTitle" /> class. /// </summary> public ChartAxisTitle() { Margin = new ChartSpacing(); Padding = new ChartSpacing(); Border = new ChartElementBorder(); Visual = new ClientHandlerDescriptor(); }
public IDictionary <string, object> SeriailzeBaseOptions() { var options = new Dictionary <string, object>(Events); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (!string.IsNullOrEmpty(DataSource.Transport.Read.Url)) { options["dataSource"] = DataSource.ToJson(); } else if (DataSource.Data != null) { options["dataSource"] = DataSource.Data; } var animation = Animation.ToJson(); if (animation.Keys.Any()) { options["animation"] = animation["animation"]; } if (!string.IsNullOrEmpty(DataTextField)) { options["dataTextField"] = DataTextField; } if (Delay != null) { options["delay"] = Delay; } if (IgnoreCase != null) { options["ignoreCase"] = IgnoreCase; } if (Height != null) { options["height"] = Height; } if (!string.IsNullOrEmpty(TemplateId)) { options["template"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TemplateId) }; } else if (!string.IsNullOrEmpty(Template)) { options["template"] = Template; } return(options); }
public TreeListColumnCommand() { //>> Initialization //<< Initialization Click = new ClientHandlerDescriptor(); }
protected override void Serialize(IDictionary <string, object> json) { base.Serialize(json); json["parameterMap"] = new ClientHandlerDescriptor { TemplateDelegate = obj => "function (data, operation) { return Template.setParams(data,operation); }" }; }
public Tooltip(ViewContext viewContext, IJavaScriptInitializer javaScriptInitializer, ViewDataDictionary viewData) : base(viewContext, javaScriptInitializer, viewData) { Callout = true; AutoHide = true; ContentHandler = new ClientHandlerDescriptor(); Animation = new PopupAnimation(); }
protected override void Serialize(IDictionary <string, object> json) { var idPrefix = "#"; if (!string.IsNullOrEmpty(Title)) { json["title"] = Title; } string viewType = Type.ToString(); json["type"] = Char.ToLowerInvariant(viewType[0]) + viewType.Substring(1); if (Editable != null) { if (Editable.Enabled == false) { json["editable"] = false; } else if (Editable.ToJson().Count > 0) { json["editable"] = Editable.ToJson(); } } if (!string.IsNullOrEmpty(EventTemplate)) { json["eventTemplate"] = EventTemplate; } if (!string.IsNullOrEmpty(EventTemplateId)) { json["eventTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventTemplateId) }; } if (!string.IsNullOrEmpty(SelectedDateFormat)) { json["selectedDateFormat"] = SelectedDateFormat; } if (Selected != false) { json["selected"] = Selected; } var group = Group.ToJson(); if (group.Count > 0) { json["group"] = group; } }
public PivotDataSourceSchema() { FunctionAxes = new ClientHandlerDescriptor(); FunctionCubes = new ClientHandlerDescriptor(); FunctionCatalogs = new ClientHandlerDescriptor(); FunctionMeasures = new ClientHandlerDescriptor(); FunctionDimensions = new ClientHandlerDescriptor(); FunctionHierarchies = new ClientHandlerDescriptor(); FunctionLevels = new ClientHandlerDescriptor(); Cube = new PivotDataSourceSchemaCube(); }
/// <summary> /// Anexa um evento. /// </summary> /// <param name="output"></param> /// <param name="value"></param> private void AppendEvent(StringBuilder output, ClientHandlerDescriptor value) { if (!string.IsNullOrEmpty(value.HandlerName)) { output.Append(value.HandlerName); } else if (value.TemplateDelegate != null) { output.Append(value.TemplateDelegate(value)); } }
public ToolBarItemButton() { //>> Initialization //<< Initialization Click = new ClientHandlerDescriptor(); Toggle = new ClientHandlerDescriptor(); HtmlAttributes = new RouteValueDictionary(); }
protected override void Serialize(IDictionary<string, object> json) { var idPrefix = "#"; if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } if (!string.IsNullOrEmpty(TemplateId)) { json["template"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template(jQuery('{0}{1}').html())", idPrefix, TemplateId) }; } }
public DataSourceSchema() { Data = "Data"; Total = "Total"; Errors = "Errors"; FunctionData = new ClientHandlerDescriptor(); FunctionTotal = new ClientHandlerDescriptor(); FunctionErrors = new ClientHandlerDescriptor(); FunctionAggregates = new ClientHandlerDescriptor(); FunctionGroups = new ClientHandlerDescriptor(); Parse = new ClientHandlerDescriptor(); }
public Transport() { Read = new CrudOperation(); Update = new CrudOperation(); Destroy = new CrudOperation(); Create = new CrudOperation(); FunctionRead = new ClientHandlerDescriptor(); FunctionUpdate = new ClientHandlerDescriptor(); FunctionDestroy = new ClientHandlerDescriptor(); FunctionCreate = new ClientHandlerDescriptor(); ParameterMap = new ClientHandlerDescriptor(); SerializeEmptyPrefix = true; SignalR = new TransportSignalR(); }
public GridBoundColumnFilterableSettings() { Enabled = true; FilterUIHandler = new ClientHandlerDescriptor(); ItemTemplate = new ClientHandlerDescriptor(); CellSettings = new GridColumnFilterableCellSettings(); DataSource = new DataSource(); DataSource.Transport.SerializeEmptyPrefix = false; DataSource.Schema.Data = ""; DataSource.Schema.Total = ""; DataSource.Schema.Errors = ""; CheckAll = true; }
private void SerializeClientTemplate(IDictionary <string, object> options) { var idPrefix = "#"; if (listView.IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (!string.IsNullOrEmpty(listView.ClientTemplateId)) { options["template"] = new ClientHandlerDescriptor { HandlerName = string.Format("kendo.template($('{0}{1}').html())", idPrefix, listView.ClientTemplateId) }; } }
public DiagramShapeDefaultsSettings() { //>> Initialization Connectors = new List <DiagramShapeDefaultsSettingsConnector>(); Hover = new DiagramShapeDefaultsHoverSettings(); Rotation = new DiagramShapeDefaultsRotationSettings(); Stroke = new DiagramShapeDefaultsStrokeSettings(); //<< Initialization Visual = new ClientHandlerDescriptor(); }
public DiagramShape() { //>> Initialization Connectors = new List<DiagramShapeConnector>(); Hover = new DiagramShapeHoverSettings(); Rotation = new DiagramShapeRotationSettings(); Stroke = new DiagramShapeStrokeSettings(); //<< Initialization Visual = new ClientHandlerDescriptor(); }
public GridColumnFilterableCellSettings() { Enabled = true; ShowOperators = true; Delay = 200; MinLength = 1; SuggestionOperator = FilterType.StartsWith; Operator = "eq"; Template = new ClientHandlerDescriptor(); DataSource = new DataSource(); DataSource.Transport.SerializeEmptyPrefix = false; DataSource.Schema.Data = ""; DataSource.Schema.Total = ""; DataSource.Schema.Errors = ""; }
protected override void Serialize(IDictionary<string, object> json) { if (ContentId.HasValue()) { json["content"] = new ClientHandlerDescriptor { HandlerName = string.Format("jQuery('{0}{1}').html()", IdPrefix, ContentId) }; } else if (Content.HasValue()) { json["content"] = Content; } if (EmptyId.HasValue()) { json["empty"] = new ClientHandlerDescriptor { HandlerName = string.Format("jQuery('{0}{1}').html()", IdPrefix, EmptyId) }; } else if (Empty.HasValue()) { json["empty"] = Empty; } }
protected override IDictionary<string, object> SeriailzeBaseOptions() { var options = base.SeriailzeBaseOptions(); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (!string.IsNullOrEmpty(TemplateId)) { options["template"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TemplateId) }; } else if (!string.IsNullOrEmpty(Template)) { options["template"] = Template; } return options; }
public DiagramShapeDefaultsSettings() { //>> Initialization Connectors = new List<DiagramShapeDefaultsSettingsConnector>(); Content = new DiagramShapeDefaultsContentSettings(); Editable = new DiagramShapeDefaultsEditableSettings(); Fill = new DiagramShapeDefaultsFillSettings(); Hover = new DiagramShapeDefaultsHoverSettings(); Rotation = new DiagramShapeDefaultsRotationSettings(); Stroke = new DiagramShapeDefaultsStrokeSettings(); //<< Initialization Visual = new ClientHandlerDescriptor(); }
private void SerializeDataSourceEvents(Dictionary <DataSourceEvent, object> Events, IDictionary <string, object> json) { foreach (var item in Events.Keys) { switch (item) { case DataSourceEvent.OnError: json["error"] = new ClientHandlerDescriptor { TemplateDelegate = obj => Events.SingleOrDefault(itm => itm.Key == DataSourceEvent.OnError).Value }; break; case DataSourceEvent.OnRequestStart: json["requestStart"] = new ClientHandlerDescriptor { TemplateDelegate = obj => Events.SingleOrDefault(itm => itm.Key == DataSourceEvent.OnRequestStart).Value }; break; case DataSourceEvent.OnRequestEnd: json["requestEnd"] = new ClientHandlerDescriptor { TemplateDelegate = obj => Events.SingleOrDefault(itm => itm.Key == DataSourceEvent.OnRequestEnd).Value }; break; case DataSourceEvent.Sync: //json["sync"] = new ClientHandlerDescriptor { TemplateDelegate = obj => Events.SingleOrDefault(itm => itm.Key == DataSourceEvent.Sync).Value }; break; case DataSourceEvent.OnChange: //json["change"] = new ClientHandlerDescriptor { TemplateDelegate = obj => Events.SingleOrDefault(itm => itm.Key == DataSourceEvent.OnChange).Value }; break; default: break; } } }
protected override void Serialize(IDictionary <string, object> json) { if (ContentId.HasValue()) { json["content"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", IdPrefix, ContentId) }; } else if (Content.HasValue()) { json["content"] = Content; } if (EmptyId.HasValue()) { json["empty"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", IdPrefix, EmptyId) }; } else if (Empty.HasValue()) { json["empty"] = Empty; } }
protected override IDictionary <string, object> SeriailzeBaseOptions() { var options = base.SeriailzeBaseOptions(); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (!string.IsNullOrEmpty(TemplateId)) { options["template"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TemplateId) }; } else if (!string.IsNullOrEmpty(Template)) { options["template"] = Template; } return(options); }
protected Dictionary <string, object> SerializeCRUDOperatonValues(OperationBase CrudOpt) { var json = new Dictionary <string, object>(); if (CrudOpt.Url != null) { var urlStr = CrudOpt.Encode(CrudOpt.Url); if (CrudOpt.Type.HasValue()) { // if (CrudOpt.Type.ToLower().Equals("Get".ToLower())) // { //json["cache"] = true; // } if ((CrudOpt.Type.ToLower().Equals("Put".ToLower()) || CrudOpt.Type.ToLower().Equals("Delete".ToLower())) && !string.IsNullOrEmpty(EntityKeyName)) { var retUrl = "function(entity) { return '" + urlStr + "/' + entity." + EntityKeyName + "; }"; json["url"] = new ClientHandlerDescriptor { TemplateDelegate = obj => retUrl }; } if (!string.IsNullOrEmpty(CrudOpt.ReadFunction)) { json["url"] = new ClientHandlerDescriptor { TemplateDelegate = obj => CrudOpt.ReadFunction + "()" }; } else { if (CrudOpt.Type.ToLower().Equals("Get".ToLower()) && CrudOpt.Params.Count > 0) { var qString = string.Empty; foreach (var param in CrudOpt.Params) { qString += param.Key + "=" + param.Value + "&"; } qString = qString.Remove(qString.Length - 1); var retUrl = "function(entity) { return " + urlStr + "/?" + qString + "; }"; json["url"] = new ClientHandlerDescriptor { TemplateDelegate = obj => retUrl }; } else { if (!string.IsNullOrEmpty(CrudOpt.ActionName)) { //var retUrl = "eval('" + ActionName + "'); } "; json["url"] = new ClientHandlerDescriptor { TemplateDelegate = obj => "eval('" + CrudOpt.ActionName + "();');" }; } else { json["url"] = urlStr; } } } } //else //{ // if (!string.IsNullOrEmpty(CrudOpt.ActionName)) // { // json["url"] = new ClientHandlerDescriptor { TemplateDelegate = obj => "function() { return " + "" + CrudOpt.ActionName + "(); }" }; // } //} if (CrudOpt.DataType.HasValue()) { json["dataType"] = CrudOpt.DataType; } if (CrudOpt.Data.HasValue()) { json["data"] = CrudOpt.Data; } if (CrudOpt.Type.HasValue()) { json["type"] = CrudOpt.Type; } } return(json); }
protected void Handler(string name, Func<object, object> handler) { Events[name] = new ClientHandlerDescriptor { TemplateDelegate = handler }; }
protected void Handler(string name, string handler) { Events[name] = new ClientHandlerDescriptor { HandlerName = handler }; }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary <string, object>(Events); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } var animation = Animation.ToJson(); if (animation.Keys.Any()) { options["animation"] = animation["animation"]; } if (ARIATemplate.HasValue()) { options["ARIATemplate"] = ARIATemplate; } if (Culture.HasValue()) { options["culture"] = Culture; } options["format"] = Format; if (ParseFormats.Any()) { options["parseFormats"] = ParseFormats; } options["min"] = Min; options["max"] = Max; if (EnableFooter) { if (FooterId.HasValue()) { options["footer"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, FooterId) }; } else if (Footer.HasValue()) { options["footer"] = Footer; } } else { options["footer"] = EnableFooter; } if (Depth.HasValue()) { options["depth"] = Depth; } if (Start.HasValue()) { options["start"] = Start; } MonthTemplate.IdPrefix = idPrefix; var month = MonthTemplate.ToJson(); if (month.Keys.Any()) { options["month"] = month; } if (Dates.Any()) { options["dates"] = Dates; } writer.Write(Initializer.Initialize(Selector, "DatePicker", options)); base.WriteInitializationScript(writer); }
public override void WriteInitializationScript(TextWriter writer) { if (DataSource.ServerFiltering && !DataSource.Transport.Read.Data.HasValue()) { DataSource.Transport.Read.Data = new ClientHandlerDescriptor { HandlerName = "function() { return kendo.ui.MultiSelect.requestData(\"" + EscapeRegex.Replace(Selector, @"\\$1") + "\"); }" }; } var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } var options = this.SeriailzeBaseOptions(); if (!string.IsNullOrEmpty(ItemTemplateId)) { options["itemTemplate"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, ItemTemplateId) }; } else if (!string.IsNullOrEmpty(ItemTemplate)) { options["itemTemplate"] = ItemTemplate; } if (!string.IsNullOrEmpty(TagTemplateId)) { options["tagTemplate"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TagTemplateId) }; } else if (!string.IsNullOrEmpty(TagTemplate)) { options["tagTemplate"] = TagTemplate; } if (AutoBind != null) { options["autoBind"] = AutoBind; } if (!string.IsNullOrEmpty(DataValueField)) { options["dataValueField"] = DataValueField; } if (!string.IsNullOrEmpty(Filter)) { options["filter"] = Filter; } if (HighlightFirst != null) { options["highlightFirst"] = HighlightFirst; } if (MaxSelectedItems != null) { options["maxSelectedItems"] = MaxSelectedItems; } if (MinLength != null) { options["minLength"] = MinLength; } if (!string.IsNullOrEmpty(Placeholder)) { options["placeholder"] = Placeholder; } var value = GetValue(); if (value != null) { options["value"] = value; } writer.Write(Initializer.Initialize(Selector, "MultiSelect", options)); base.WriteInitializationScript(writer); }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary <string, object>(Events); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (Culture.HasValue()) { options["culture"] = Culture; } if (Value.HasValue) { options["value"] = Value; } if (Min.HasValue) { options["min"] = Min; } if (Max.HasValue) { options["max"] = Max; } if (Format.HasValue()) { options["format"] = Format; } if (EnableFooter) { if (FooterId.HasValue()) { options["footer"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, FooterId) }; } else if (Footer.HasValue()) { options["footer"] = Footer; } } else { options["footer"] = EnableFooter; } if (Depth.HasValue()) { options["depth"] = Depth; } if (Start.HasValue()) { options["start"] = Start; } MonthTemplate.IdPrefix = idPrefix; var month = MonthTemplate.ToJson(); if (month.Keys.Any()) { options["month"] = month; } if (SelectionSettings.Dates.Any()) { options["dates"] = SelectionSettings.Dates; } var url = SelectionSettings.GenerateUrl(ViewContext, urlGenerator); if (url.HasValue()) { options["url"] = url; } writer.Write(Initializer.Initialize(Selector, "Calendar", options)); base.WriteInitializationScript(writer); }
//<< Fields protected override void Serialize(IDictionary<string, object> json) { //>> Serialization if (Align.HasValue()) { json["align"] = Align; } if (Color.HasValue()) { json["color"] = Color; } if (FontFamily.HasValue()) { json["fontFamily"] = FontFamily; } if (FontSize.HasValue) { json["fontSize"] = FontSize; } if (!string.IsNullOrEmpty(TemplateId)) { json["template"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", TemplateId ) }; } else if (!string.IsNullOrEmpty(Template)) { json["template"] = Template; } if (Text.HasValue()) { json["text"] = Text; } //<< Serialization }
protected virtual IDictionary <string, object> SeriailzeBaseOptions() { var options = new Dictionary <string, object>(Events); var idPrefix = "#"; if (Date != null) { options["date"] = Date; } if (StartTime != null) { options["startTime"] = StartTime; } if (EndTime != null) { options["endTime"] = EndTime; } if (Min != null) { options["min"] = Min; } if (Max != null) { options["max"] = Max; } if (WorkDayStart != null) { options["workDayStart"] = WorkDayStart; } if (WorkDayEnd != null) { options["workDayEnd"] = WorkDayEnd; } if (Height != null) { options["height"] = Height; } if (Editable.Enabled == false) { options["editable"] = false; } else { Editable.InitializeEditor(ViewContext, ViewData); IDictionary <string, object> editable = Editable.ToJson(); if (editable.Count > 0) { options["editable"] = editable; } } if (!string.IsNullOrEmpty(EventTemplate)) { options["eventTemplate"] = EventTemplate; } if (!string.IsNullOrEmpty(EventTemplateId)) { options["eventTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventTemplateId) }; } if (!string.IsNullOrEmpty(AllDayEventTemplate)) { options["allDayEventTemplate"] = AllDayEventTemplate; } if (!string.IsNullOrEmpty(AllDayEventTemplateId)) { options["allDayEventTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, AllDayEventTemplateId) }; } if (!AllDaySlot) { options["allDaySlot"] = AllDaySlot; } if (Selectable) { options["selectable"] = Selectable; } if (!string.IsNullOrEmpty(DateHeaderTemplate)) { options["dateHeaderTemplate"] = DateHeaderTemplate; } if (!string.IsNullOrEmpty(DateHeaderTemplateId)) { options["dateHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, DateHeaderTemplateId) }; } if (MajorTick != null) { options["majorTick"] = MajorTick; } if (ShowWorkHours) { options["showWorkHours"] = ShowWorkHours; } if (!string.IsNullOrEmpty(MajorTimeHeaderTemplate)) { options["majorTimeHeaderTemplate"] = MajorTimeHeaderTemplate; } if (!string.IsNullOrEmpty(MajorTimeHeaderTemplateId)) { options["majorTimeHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, MajorTimeHeaderTemplateId) }; } if (!string.IsNullOrEmpty(MinorTimeHeaderTemplate)) { options["minorTimeHeaderTemplate"] = MinorTimeHeaderTemplate; } if (!string.IsNullOrEmpty(MinorTimeHeaderTemplateId)) { options["minorTimeHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, MinorTimeHeaderTemplateId) }; } if (MinorTickCount != null) { options["minorTickCount"] = MinorTickCount; } if (!string.IsNullOrEmpty(Timezone)) { options["timezone"] = Timezone; } if (Width != null) { options["width"] = Width; } if (!Snap) { options["snap"] = Snap; } if (!AutoBind) { options["autoBind"] = AutoBind; } if (WorkWeekStart != null) { options["workWeekStart"] = WorkWeekStart; } if (WorkWeekEnd != null) { options["workWeekEnd"] = WorkWeekEnd; } if (Resources.Count > 0) { options["resources"] = Resources.ToJson(); } if (Views.Count > 0) { options["views"] = Views.ToJson(); } var messages = Messages.ToJson(); if (messages.Count > 0) { options["messages"] = messages; } var group = Group.ToJson(); if (group.Count > 0) { options["group"] = group; } if (Mobile != MobileMode.Disabled) { if (Mobile == MobileMode.Auto) { options["mobile"] = true; } else { options["mobile"] = Mobile.ToString().ToLowerInvariant(); } } if (DataSource.Type != DataSourceType.Custom || DataSource.CustomType == "aspnetmvc-ajax") { DataSource.Transport.StringifyDates = true; if (DataSource.IsClientOperationMode) { ProcessDataSource(); } } Dictionary <string, object> dataSource = (Dictionary <string, object>)DataSource.ToJson(); options["dataSource"] = dataSource; return(options); }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary <string, object>(Events); if (!string.IsNullOrEmpty(DataSource.Transport.Read.Url)) { options["dataSource"] = DataSource.ToJson(); } else if (DataSource.Data != null) { options["dataSource"] = DataSource.Data; } if (DragAndDrop) { options["dragAndDrop"] = true; } if (AutoBind) { options["autoBind"] = true; } if (!LoadOnDemand) { options["loadOnDemand"] = false; } if (!string.IsNullOrEmpty(DataTextField)) { options["dataTextField"] = DataTextField; } if (!string.IsNullOrEmpty(DataUrlField)) { options["dataUrlField"] = DataUrlField; } if (!string.IsNullOrEmpty(DataSpriteCssClassField)) { options["dataSpriteCssClassField"] = DataSpriteCssClassField; } if (!string.IsNullOrEmpty(DataImageUrlField)) { options["dataImageUrlField"] = DataImageUrlField; } var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (!string.IsNullOrEmpty(TemplateId)) { options["template"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TemplateId) }; } else if (!string.IsNullOrEmpty(Template)) { options["template"] = Template; } var checkboxes = Checkboxes.ToJson(); if (checkboxes.Keys.Any()) { options["checkboxes"] = checkboxes["checkboxes"]; } var animation = Animation.ToJson(); if (animation.Keys.Any()) { options["animation"] = animation["animation"]; } writer.Write(Initializer.Initialize(Selector, "TreeView", options)); base.WriteInitializationScript(writer); }
public OperationBase() { Params = new Dictionary <string, object>(); Data = new ClientHandlerDescriptor(); DataType = "JSON"; }
public EditorCustomButtonTool() { Exec = new ClientHandlerDescriptor(); }
protected void Handler(string name, Func <object, object> handler) { Events[name] = new ClientHandlerDescriptor { TemplateDelegate = handler }; }
private void AppendEvent(StringBuilder output, ClientHandlerDescriptor value) { if (value.HandlerName.HasValue()) { output.Append(value.HandlerName); } else if (value.TemplateDelegate != null) { output.Append(value.TemplateDelegate(value)); } }
protected override void Serialize(IDictionary<string, object> json) { base.Serialize(json); var idPrefix = "#"; if (!string.IsNullOrEmpty(AllDayEventTemplate)) { json["allDayEventTemplate"] = AllDayEventTemplate; } if (!AllDaySlot) { json["allDaySlot"] = AllDaySlot; } if (!string.IsNullOrEmpty(DateHeaderTemplate)) { json["dateHeaderTemplate"] = DateHeaderTemplate; } if (!string.IsNullOrEmpty(DateHeaderTemplateId)) { json["dateHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, DateHeaderTemplateId) }; } if (MajorTick != null) { json["majorTick"] = MajorTick; } if (!string.IsNullOrEmpty(MajorTimeHeaderTemplate)) { json["majorTimeHeaderTemplate"] = MajorTimeHeaderTemplate; } if (!string.IsNullOrEmpty(MajorTimeHeaderTemplateId)) { json["majorTimeHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, MajorTimeHeaderTemplateId) }; } if (MinorTickCount != null) { json["minorTickCount"] = MinorTickCount; } if (!string.IsNullOrEmpty(MinorTimeHeaderTemplate)) { json["minorTimeHeaderTemplate"] = MinorTimeHeaderTemplate; } if (!string.IsNullOrEmpty(MinorTimeHeaderTemplateId)) { json["minorTimeHeaderTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, MinorTimeHeaderTemplateId) }; } if (StartTime != null) { json["startTime"] = StartTime; } if (EndTime != null) { json["endTime"] = EndTime; } }
public ModelFieldDescriptor() { this.IsEditable = true; this.Parse = new ClientHandlerDescriptor(); }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary<string, object>(Events); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (Culture.HasValue()) { options["culture"] = Culture; } if (Value.HasValue) { options["value"] = Value; } if (Min.HasValue) { options["min"] = Min; } if (Max.HasValue) { options["max"] = Max; } if (Format.HasValue()) { options["format"] = Format; } if (EnableFooter) { if (FooterId.HasValue()) { options["footer"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, FooterId) }; } else if (Footer.HasValue()) { options["footer"] = Footer; } } else { options["footer"] = EnableFooter; } if (Depth.HasValue()) { options["depth"] = Depth; } if (Start.HasValue()) { options["start"] = Start; } MonthTemplate.IdPrefix = idPrefix; var month = MonthTemplate.ToJson(); if (month.Keys.Any()) { options["month"] = month; } if (SelectionSettings.Dates.Any()) { options["dates"] = SelectionSettings.Dates; } var url = SelectionSettings.GenerateUrl(ViewContext, urlGenerator); if (url.HasValue()) { options["url"] = url; } writer.Write(Initializer.Initialize(Selector, "Calendar", options)); base.WriteInitializationScript(writer); }
//<< Fields protected override void Serialize(IDictionary<string, object> json) { //>> Serialization if (ComparerType.HasValue()) { json["comparerType"] = ComparerType; } if (DataType.HasValue()) { json["dataType"] = DataType; } if (From.HasValue()) { json["from"] = From; } if (To.HasValue()) { json["to"] = To; } if (AllowNulls.HasValue()) { json["allowNulls"] = AllowNulls; } if (!string.IsNullOrEmpty(MessageTemplateId)) { json["messageTemplate"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", MessageTemplateId ) }; } else if (!string.IsNullOrEmpty(MessageTemplate)) { json["messageTemplate"] = MessageTemplate; } if (!string.IsNullOrEmpty(TitleTemplateId)) { json["titleTemplate"] = new ClientHandlerDescriptor { HandlerName = string.Format( "jQuery('#{0}').html()", TitleTemplateId ) }; } else if (!string.IsNullOrEmpty(TitleTemplate)) { json["titleTemplate"] = TitleTemplate; } //<< Serialization }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary<string, object>(Events); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } var animation = Animation.ToJson(); if (animation.Keys.Any()) { options["animation"] = animation["animation"]; } if (Culture.HasValue()) { options["culture"] = Culture; } options["format"] = Format; if (TimeFormat.HasValue()) { options["timeFormat"] = TimeFormat; } if (ParseFormats.Any()) { options["parseFormats"] = ParseFormats; } options["min"] = Min; options["max"] = Max; if (FooterId.HasValue()) { options["footer"] = new ClientHandlerDescriptor { HandlerName = string.Format("$('{0}{1}').html()", idPrefix, FooterId) }; } else if (Footer.HasValue()) { options["footer"] = Footer; } if (Depth.HasValue()) { options["depth"] = Depth; } if (Start.HasValue()) { options["start"] = Start; } MonthTemplate.IdPrefix = idPrefix; var month = MonthTemplate.ToJson(); if (month.Keys.Any()) { options["month"] = month; } options["interval"] = Interval; if (Dates.Any()) { options["dates"] = Dates; } writer.Write(Initializer.Initialize(Selector, "DateTimePicker", options)); base.WriteInitializationScript(writer); }
public override void WriteInitializationScript(TextWriter writer) { var options = new Dictionary <string, object>(Events); var autoBind = DataSource.Type != DataSourceType.Server && AutoBind.GetValueOrDefault(true); var columns = VisibleColumns.Select(c => c.ToJson()); var idPrefix = "#"; if (IsInClientTemplate) { idPrefix = "\\" + idPrefix; } if (columns.Any()) { options["columns"] = columns; } if (Grouping.Enabled) { options["groupable"] = Grouping.ToJson(); } if (Pageable.Enabled) { Pageable.AutoBind = autoBind; options["pageable"] = Pageable.ToJson(); } if (Sortable.Enabled) { var sorting = Sortable.ToJson(); options["sortable"] = sorting.Any() ? (object)sorting : true; } if (Selectable.Enabled) { options["selectable"] = String.Format("{0}, {1}", Selectable.Mode, Selectable.Type); } if (Filterable.Enabled) { var filtering = Filterable.ToJson(); options["filterable"] = filtering.Any() ? (object)filtering : true; } if (ColumnMenu.Enabled) { var menu = ColumnMenu.ToJson(); options["columnMenu"] = menu.Any() ? (object)menu : true; } if (Resizable.Enabled) { options["resizable"] = true; } if (ColumnResizeHandleWidth != defaultColumnResizeHandleWidth) { options["columnResizeHandleWidth"] = ColumnResizeHandleWidth; } if (Reorderable.Enabled) { options["reorderable"] = true; } if (!Scrollable.Enabled) { options["scrollable"] = false; } else { var scrolling = Scrollable.ToJson(); if (scrolling.Any()) { options["scrollable"] = scrolling; } } if (Editable.Enabled) { options["editable"] = Editable.ToJson(); } if (ToolBar.Enabled) { options["toolbar"] = ToolBar.ToJson(); } if (autoBind == false) { options["autoBind"] = autoBind; } options["dataSource"] = DataSource.ToJson(); if (!String.IsNullOrEmpty(ClientDetailTemplateId)) { options["detailTemplate"] = new ClientHandlerDescriptor { HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, ClientDetailTemplateId) }; } if (!String.IsNullOrEmpty(ClientRowTemplate)) { options["rowTemplate"] = ClientRowTemplate; } if (!String.IsNullOrEmpty(ClientAltRowTemplate)) { options["altRowTemplate"] = ClientAltRowTemplate; } if (Navigatable.Enabled) { options["navigatable"] = true; } if (Mobile != MobileMode.Disabled) { if (Mobile == MobileMode.Auto) { options["mobile"] = true; } else { options["mobile"] = Mobile.ToString().ToLowerInvariant(); } } writer.Write(Initializer.Initialize(Selector, "Grid", options)); base.WriteInitializationScript(writer); }