Exemplo n.º 1
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tDatePicker", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Append("format", this.Format);
            objectWriter.Append("todayFormat", TodayFormat);
            objectWriter.AppendDateOnly("minValue", this.MinValue);
            objectWriter.AppendDateOnly("maxValue", this.MaxValue);
            objectWriter.AppendDateOnly("selectedValue", this.Value);
            objectWriter.Append("enabled", this.Enabled, true);
            objectWriter.Append("openOnFocus", this.OpenOnFocus, false);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 2
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tDateTimePicker", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Append("format", this.Format);
            objectWriter.Append("todayFormat", TodayFormat);
            objectWriter.Append("minValue", this.MinValue);
            objectWriter.Append("maxValue", this.MaxValue);
            objectWriter.Append("startTimeValue", this.StartTime);
            objectWriter.Append("endTimeValue", this.EndTime);
            objectWriter.Append("interval", this.Interval);
            objectWriter.Append("selectedValue", this.Value);
            objectWriter.Append("enabled", this.Enabled, true);

            if (DropDownHtmlAttributes.Any())
            {
                objectWriter.Append("dropDownAttr", DropDownHtmlAttributes.ToAttributeString());
            }

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
 public void SerializeTo(IClientSideObjectWriter writer)
 {
     writer.Append("multiple", Enabled, false);
     if (!Separator.Equals(defaultSeparator))
     {
         writer.Append("separator", Separator);
     }
 }
Exemplo n.º 4
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer);

            objectWriter.Start();

            objectWriter.AppendObject("val", Value);
            objectWriter.Append("step", IncrementStep);
            objectWriter.AppendObject("minValue", MinValue);
            objectWriter.AppendObject("maxValue", MaxValue);
            objectWriter.Append("symbol", PercentSymbol);
            objectWriter.Append("digits", DecimalDigits);
            objectWriter.Append("separator", DecimalSeparator);
            objectWriter.AppendNullableString("groupSeparator", NumberGroupSeparator);
            objectWriter.Append("groupSize", NumberGroupSize);
            objectWriter.Append("positive", PositivePatternIndex);
            objectWriter.Append("negative", NegativePatternIndex);
            objectWriter.Append("text", EmptyMessage);
            objectWriter.Append("type", "percent");

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 5
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("sortMode", SortMode == GridSortMode.MultipleColumn ? "multi" : "single");
         if (grid.DataProcessor.SortDescriptors.Any())
         {
             writer.Append("orderBy", GridDescriptorSerializer.Serialize(grid.DataProcessor.SortDescriptors));
         }
     }
 }
Exemplo n.º 6
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("sortMode", SortMode == GridSortMode.MultipleColumn ? "multi" : "single");
         if (grid.DataProcessor.SortDescriptors.Any())
         {
             writer.Append("orderBy", GridDescriptorSerializer.Serialize(grid.DataProcessor.SortDescriptors));
         }
     }
 }
Exemplo n.º 7
0
        private void SerializeProperties(IClientSideObjectWriter objectWriter)
        {
            objectWriter.Append("orientation", Orientation, SliderOrientation.Horizontal);
            objectWriter.Append("tickPlacement", TickPlacement, SliderTickPlacement.Both);
            objectWriter.AppendObject("smallStep", SmallStep);
            objectWriter.AppendObject("largeStep", LargeStep);
            objectWriter.AppendObject("minValue", MinValue);
            objectWriter.AppendObject("maxValue", MaxValue);
            objectWriter.Append("enabled", Enabled, true);

            Settings.SerializeTo("tooltip", objectWriter);
        }
Exemplo n.º 8
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tComboBox", writer);

            objectWriter.Start();

            objectWriter.Append("autoFill", AutoFill, true);
            objectWriter.Append("highlightFirst", HighlightFirstMatch, true);

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            ClientEvents.SerializeTo(objectWriter);

            DataBinding.Ajax.SerializeTo <AutoCompleteBindingSettings>("ajax", objectWriter, this);
            DataBinding.WebService.SerializeTo <AutoCompleteBindingSettings>("ws", objectWriter, this);

            if (Filtering.Enabled)
            {
                objectWriter.Append("filter", (int)Filtering.FilterMode);
                objectWriter.Append("minChars", Filtering.MinimumChars, 0);
            }

            if (Items.Any())
            {
                objectWriter.AppendCollection("data", Items);
            }
            else
            {
                objectWriter.Append("selectedValue", this.GetValue <string>(Value));
            }

            objectWriter.Append("index", SelectedIndex, -1);

            if (DropDownHtmlAttributes.Any())
            {
                objectWriter.Append("dropDownAttr", DropDownHtmlAttributes.ToAttributeString());
            }

            objectWriter.Append("encoded", this.Encoded, true);
            objectWriter.Append("enabled", this.Enabled, true);
            objectWriter.Append("openOnFocus", this.OpenOnFocus, false);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Write the initilisation script for the control.
        /// </summary>
        /// <param name="writer">The current text writer</param>
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter controlWriter = ClientSideObjectWriterFactory.Create(Id, "TreeView", writer);

            controlWriter.Start();

            if (!UseExtendedControlOnly)
            {
                controlWriter.Append("persist", "location");
                controlWriter.Append("persist", "location");
                controlWriter.Append("persist", "location");
            }

            controlWriter.Complete();
            base.WriteInitializationScript(writer);
        }
Exemplo n.º 10
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tSplitter", writer);

            objectWriter.Start();

            objectWriter.Append <SplitterOrientation>("orientation", Orientation, SplitterOrientation.Horizontal);

            var panes = new List <IDictionary <string, object> >();

            Panes.Each(pane =>
            {
                panes.Add(pane.Serialize());
            });

            if (panes.Any())
            {
                objectWriter.AppendCollection("panes", panes);
            }

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
        public void SerializeTo(IClientSideObjectWriter writer)
        {
            if (!grid.IsClientBinding)
            {
                grid.Server.Select.RouteValues.Merge(grid.ViewContext.RequestContext.RouteData.Values);

                if (grid.Paging.Enabled)
                {
                    grid.Server.Select.RouteValues[grid.Prefix(GridUrlParameters.CurrentPage)] = "{0}";
                }

                if (grid.Sorting.Enabled)
                {
                    grid.Server.Select.RouteValues[grid.Prefix(GridUrlParameters.OrderBy)] = "{1}";
                }

                if (grid.Grouping.Enabled)
                {
                    grid.Server.Select.RouteValues[grid.Prefix(GridUrlParameters.GroupBy)] = "{2}";
                }

                if (grid.Filtering.Enabled)
                {
                    grid.Server.Select.RouteValues[grid.Prefix(GridUrlParameters.Filter)] = "{3}";
                }

                writer.Append("urlFormat", grid.UrlBuilder.Url(grid.Server.Select, AppendPageSize));
            }
        }
Exemplo n.º 12
0
 private void SerializeTheme(IClientSideObjectWriter objectWriter)
 {
     if (Theme.HasValue())
     {
         objectWriter.Append("theme", Theme);
     }
 }
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("columnContextMenu", Enabled);
     }
 }
Exemplo n.º 14
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("selectable", true);
     }
 }
Exemplo n.º 15
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tPanelBar", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            objectWriter.AppendClientEvent("onExpand", ClientEvents.OnExpand);
            objectWriter.AppendClientEvent("onCollapse", ClientEvents.OnCollapse);
            objectWriter.AppendClientEvent("onSelect", ClientEvents.OnSelect);
            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);
            objectWriter.AppendClientEvent("onError", ClientEvents.OnError);

            objectWriter.Append("expandMode", (int)ExpandMode);

            objectWriter.AppendContentUrls("contentUrls", Items, IsSelfInitialized);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("selectable", true);
     }
 }
Exemplo n.º 17
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tMenu", writer);

            objectWriter.Start()
            .Append("orientation", Orientation, MenuOrientation.Horizontal);

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            if (OpenOnClick)
            {
                objectWriter.Append("openOnClick", true);
            }

            objectWriter.AppendClientEvent("onOpen", ClientEvents.OnOpen);
            objectWriter.AppendClientEvent("onClose", ClientEvents.OnClose);
            objectWriter.AppendClientEvent("onSelect", ClientEvents.OnSelect);
            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 18
0
 private void SerializeTransitions(IClientSideObjectWriter objectWriter)
 {
     if (!Transitions)
     {
         objectWriter.Append("transitions", Transitions);
     }
 }
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("columnContextMenu", Enabled);
     }
 }
        public static void SerializeTo <TSettings>(this IDropDownBindingSettings instance, string key, IClientSideObjectWriter writer, IDataBoundDropDown component)
            where TSettings : AutoCompleteBindingSettings
        {
            if (instance.Enabled)
            {
                var url = new Dictionary <string, string>();

                if (instance.Select.HasValue())
                {
                    url["selectUrl"] = component.UrlGenerator.Generate(component.ViewContext.RequestContext, instance.Select);
                }

                writer.AppendObject(key, url);
                writer.Append("cache", (instance as TSettings).Cache, true);
                writer.Append("delay", (instance as TSettings).Delay, 200);
            }
        }
Exemplo n.º 21
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tWindow", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            //client events
            objectWriter.AppendClientEvent("onClose", ClientEvents.OnClose);
            objectWriter.AppendClientEvent("onError", ClientEvents.OnError);
            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);
            objectWriter.AppendClientEvent("onDragStart", ClientEvents.OnDragStart);
            objectWriter.AppendClientEvent("onDragEnd", ClientEvents.OnDragEnd);
            objectWriter.AppendClientEvent("onOpen", ClientEvents.OnOpen);
            objectWriter.AppendClientEvent("onActivate", ClientEvents.OnActivate);
            objectWriter.AppendClientEvent("onResize", ClientEvents.OnResize);
            objectWriter.AppendClientEvent("onRefresh", ClientEvents.OnRefresh);

            //properties
            objectWriter.Append("modal", Modal);
            objectWriter.Append("contentUrl", ContentUrl);
            objectWriter.Append("draggable", Draggable);
            objectWriter.Append("resizable", ResizingSettings.Enabled);

            if (ResizingSettings.Enabled)
            {
                if (ResizingSettings.MinHeight != int.MinValue)
                {
                    objectWriter.Append("minHeight", ResizingSettings.MinHeight);
                }

                if (ResizingSettings.MinWidth != int.MinValue)
                {
                    objectWriter.Append("minWidth", ResizingSettings.MinWidth);
                }

                if (ResizingSettings.MaxHeight != int.MinValue)
                {
                    objectWriter.Append("maxHeight", ResizingSettings.MaxHeight);
                }

                if (ResizingSettings.MaxWidth != int.MinValue)
                {
                    objectWriter.Append("maxWidth", ResizingSettings.MaxWidth);
                }
            }

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 22
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         if (grid.DataProcessor.GroupDescriptors.Any())
         {
             writer.AppendCollection("groups", SerializeDescriptors());
             writer.Append("groupBy", SerializeExpression());
         }
     }
 }
Exemplo n.º 23
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         if (grid.DataProcessor.GroupDescriptors.Any())
         {
             writer.AppendCollection("groups", SerializeDescriptors());
             writer.Append("groupBy", SerializeExpression());
         }
     }
 }
Exemplo n.º 24
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tCalendar", writer);

            objectWriter.Start();

            objectWriter.AppendDateOnly("selectedDate", this.Value);
            objectWriter.AppendDateOnly("minDate", this.MinDate);
            objectWriter.AppendDateOnly("maxDate", this.MaxDate);

            objectWriter.AppendDatesOnly("dates", SelectionSettings.Dates);
            objectWriter.Append("urlFormat", urlFormat);
            objectWriter.Append("todayFormat", TodayFormat);

            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);
            objectWriter.AppendClientEvent("onChange", ClientEvents.OnChange);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 25
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer);

            objectWriter.Start();

            objectWriter.AppendObject("val", this.Value);
            objectWriter.AppendObject("step", this.IncrementStep);
            objectWriter.AppendObject("minValue", this.MinValue);
            objectWriter.AppendObject("maxValue", this.MaxValue);
            objectWriter.Append("digits", this.DecimalDigits);
            objectWriter.Append("separator", this.DecimalSeparator);
            objectWriter.AppendNullableString("groupSeparator", this.NumberGroupSeparator);
            objectWriter.Append("groupSize", this.NumberGroupSize);
            objectWriter.Append("negative", this.NegativePatternIndex);
            objectWriter.Append("text", this.EmptyMessage);
            objectWriter.Append("type", "numeric");

            var inputAttributes = new Dictionary <string, string>();

            this.InputHtmlAttributes.Each(x => inputAttributes.Add(x.Key, x.Value.ToString()));
            objectWriter.AppendObject("inputAttributes", inputAttributes);

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 26
0
        public void SerializeTo(string key, IClientSideObjectWriter writer)
        {
            if (Enabled)
            {
                writer.Append("pageSize", PageSize, 10);
                writer.Append("total", grid.DataProcessor.Total);
                writer.Append("currentPage", grid.DataProcessor.CurrentPage);
                writer.AppendCollection("pageSizesInDropDown", PageSizesInDropDown.Select(v => v.ToString(CultureInfo.InvariantCulture)));

                writer.Append("pageOnScroll", PageOnScroll);
                if (grid.IsClientBinding && PageOnScroll)
                {
                    if (!grid.IsEmpty)
                    {
                        var dataTableEnumerable = grid.DataSource as GridDataTableWrapper;
                        if (dataTableEnumerable != null && dataTableEnumerable.Table != null)
                        {
                            writer.AppendCollection("data",
                                                    grid.DataProcessor.ProcessedDataSource.SerializeToDictionary(
                                                        dataTableEnumerable.Table));
                        }
                        else if (grid.DataProcessor.ProcessedDataSource is IQueryable <AggregateFunctionsGroup> )
                        {
                            IEnumerable <IGroup> grouppedDataSource = grid.DataProcessor.ProcessedDataSource.Cast <IGroup>();
                            writer.AppendCollection("data", grouppedDataSource.Leaves());
                        }
                        else
                        {
                            writer.AppendCollection("data", grid.DataProcessor.ProcessedDataSource);
                        }
                    }
                }
            }
            else
            {
                writer.Append("pageSize", 0);
            }
        }
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         if (EditOnTab)
         {
             writer.AppendObject("keyboardNavigation", new { editOnTab = EditOnTab });
         }
         else
         {
             writer.Append("keyboardNavigation", Enabled);
         }
     }
 }
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         if (EditOnTab)
         {
             writer.AppendObject("keyboardNavigation", new { editOnTab = EditOnTab });
         }
         else
         {
             writer.Append("keyboardNavigation", Enabled);
         }
     }
 }
Exemplo n.º 29
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tDropDownList", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            ClientEvents.SerializeTo(objectWriter);

            DataBinding.Ajax.SerializeTo("ajax", objectWriter, this);
            DataBinding.WebService.SerializeTo("ws", objectWriter, this);

            objectWriter.Append("delay", Delay, 500);
            objectWriter.Append("placeholder", this.Placeholder);
            objectWriter.Append("cascadeTo", this.CascadeTo);

            if (hasItems)
            {
                objectWriter.AppendCollection("data", Items);
            }
            else
            {
                objectWriter.Append("selectedValue", this.GetValue <string>(Value));
            }

            objectWriter.Append("index", SelectedIndex, 0);

            if (DropDownHtmlAttributes.Any())
            {
                objectWriter.Append("dropDownAttr", DropDownHtmlAttributes.ToAttributeString());
            }

            objectWriter.Append("enabled", this.Enabled, true);
            objectWriter.Append("encoded", this.Encoded, true);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 30
0
        public static void Serialize(this IClientSideObjectWriter objectWriter, string propertyName, IEffectContainer effects)
        {
            var effectSerialization = new List <string>();

            var propertyAnimations = new List <PropertyAnimation>();

            effects.Container.Each(e =>
            {
                if (e is PropertyAnimation)
                {
                    propertyAnimations.Add(e as PropertyAnimation);
                }
                else
                {
                    effectSerialization.Add(e.Serialize());
                }
            });

            if (propertyAnimations.Count > 0)
            {
                propertyAnimations.Each(e => effects.Container.Remove(e));

                var animatedProperties = new List <string>();

                propertyAnimations.Each(e =>
                                        animatedProperties.Add(
                                            e.AnimationType.ToString().ToLower(CultureInfo.InvariantCulture)));

                effectSerialization.Add(
                    String.Format("{{name:'property',properties:['{0}']}}",
                                  String.Join("','", animatedProperties.ToArray())));
            }

            objectWriter.Append("{0}:{{list:[{1}],openDuration:{2},closeDuration:{3}}}".FormatWith(propertyName,
                                                                                                   String.Join(",", effectSerialization.ToArray()),
                                                                                                   effects.OpenDuration, effects.CloseDuration));
        }
Exemplo n.º 31
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tAutoComplete", writer);

            objectWriter.Start();

            objectWriter.Append("autoFill", AutoFill, false);
            objectWriter.Append("highlightFirst", HighlightFirstMatch, false);

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            ClientEvents.SerializeTo(objectWriter);
            Multiple.SerializeTo(objectWriter);

            DataBinding.Ajax.SerializeTo <AutoCompleteBindingSettings>("ajax", objectWriter, this);
            DataBinding.WebService.SerializeTo <AutoCompleteBindingSettings>("ws", objectWriter, this);

            objectWriter.Append("filter", Filtering.FilterMode == AutoCompleteFilterMode.Contains ? 2 : 1); //"contains" : "startsWith");
            objectWriter.Append("minChars", Filtering.MinimumChars, 1);

            if (Items.Any())
            {
                objectWriter.AppendCollection("data", Items);
            }

            if (DropDownHtmlAttributes.Any())
            {
                objectWriter.Append("dropDownAttr", DropDownHtmlAttributes.ToAttributeString());
            }

            objectWriter.Append("encoded", this.Encoded, true);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 32
0
        public override void WriteInitializationScript(System.IO.TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTextBox", writer);

            objectWriter.Start();

            objectWriter.AppendObject("val", this.Value);
            objectWriter.Append("step", this.IncrementStep);
            objectWriter.AppendObject("minValue", this.MinValue);
            objectWriter.AppendObject("maxValue", this.MaxValue);
            objectWriter.Append("digits", 0);
            objectWriter.AppendNullableString("groupSeparator", this.NumberGroupSeparator);
            objectWriter.Append("groupSize", this.NumberGroupSize);
            objectWriter.Append("negative", this.NegativePatternIndex);
            objectWriter.Append("text", this.EmptyMessage);
            objectWriter.Append("type", "numeric");

            ClientEvents.SerializeTo(objectWriter);

            objectWriter.Complete();

            base.WriteInitializationScript(writer);
        }
Exemplo n.º 33
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled)
     {
         writer.Append("pageSize", PageSize, 10);
         writer.Append("total", grid.DataProcessor.Total);
         writer.Append("currentPage", grid.DataProcessor.CurrentPage);
     }
     else
     {
         writer.Append("pageSize", 0);
     }
 }
Exemplo n.º 34
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTreeView", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            if (!ShowLines)
            {
                objectWriter.Append("showLines", ShowLines);
            }

            if (ShowCheckBox)
            {
                objectWriter.Append("showCheckBox", ShowCheckBox);
            }

            if (DragAndDrop.Enabled)
            {
                if (DragAndDrop.DropTargets.HasValue())
                {
                    var dragAndDropOptions = new Dictionary <string, string>();

                    dragAndDropOptions["dropTargets"] = DragAndDrop.DropTargets;

                    objectWriter.AppendObject("dragAndDrop", dragAndDropOptions);
                }
                else
                {
                    objectWriter.Append("dragAndDrop", true);
                }
            }

            if (Ajax.Enabled)
            {
                Dictionary <string, string> ajax = new Dictionary <string, string>();

                ajax["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, Ajax.Select);

                objectWriter.AppendObject("ajax", ajax);
            }

            if (WebService.Enabled)
            {
                Dictionary <string, string> webService = new Dictionary <string, string>();

                webService["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, WebService.Select.Url);

                objectWriter.AppendObject("ws", webService);
            }

            objectWriter.AppendClientEvent("onExpand", ClientEvents.OnExpand);
            objectWriter.AppendClientEvent("onCollapse", ClientEvents.OnCollapse);
            objectWriter.AppendClientEvent("onSelect", ClientEvents.OnSelect);
            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);
            objectWriter.AppendClientEvent("onError", ClientEvents.OnError);
            objectWriter.AppendClientEvent("onChecked", ClientEvents.OnChecked);
            objectWriter.AppendClientEvent("onNodeDragStart", ClientEvents.OnNodeDragStart);
            objectWriter.AppendClientEvent("onNodeDragging", ClientEvents.OnNodeDragging);
            objectWriter.AppendClientEvent("onNodeDragCancelled", ClientEvents.OnNodeDragCancelled);
            objectWriter.AppendClientEvent("onNodeDrop", ClientEvents.OnNodeDrop);
            objectWriter.AppendClientEvent("onNodeDropped", ClientEvents.OnNodeDropped);
            objectWriter.AppendClientEvent("onDataBinding", ClientEvents.OnDataBinding);
            objectWriter.AppendClientEvent("onDataBound", ClientEvents.OnDataBound);

            objectWriter.Complete();
            base.WriteInitializationScript(writer);
        }
Exemplo n.º 35
0
        public void SerializeTo(string key, IClientSideObjectWriter writer)
        {
            if (Enabled)
            {
                writer.Append("pageSize", PageSize, 10);
                writer.Append("total", grid.DataProcessor.Total);
                writer.Append("currentPage", grid.DataProcessor.CurrentPage);
                writer.AppendCollection("pageSizesInDropDown", PageSizesInDropDown.Select(v => v.ToString(CultureInfo.InvariantCulture)));

                writer.Append("pageOnScroll", PageOnScroll);
                if (grid.IsClientBinding && PageOnScroll)
                {
                    if (!grid.IsEmpty)
                    {
                        var dataTableEnumerable = grid.DataSource as GridDataTableWrapper;
                        if (dataTableEnumerable != null && dataTableEnumerable.Table != null)
                        {
                            writer.AppendCollection("data",
                                                    grid.DataProcessor.ProcessedDataSource.SerializeToDictionary(
                                                        dataTableEnumerable.Table));

                        }
                        else if (grid.DataProcessor.ProcessedDataSource is IQueryable<AggregateFunctionsGroup>)
                        {
                            IEnumerable<IGroup> grouppedDataSource = grid.DataProcessor.ProcessedDataSource.Cast<IGroup>();
                            writer.AppendCollection("data", grouppedDataSource.Leaves());
                        }
                        else
                        {
                            writer.AppendCollection("data", grid.DataProcessor.ProcessedDataSource);
                        }
                    }
                }                
            }
            else
            {
                writer.Append("pageSize", 0);
            }
        }
Exemplo n.º 36
0
        public void Serialize(IClientSideObjectWriter writer)
        {
            var columns = new List <IDictionary <string, object> >();

            grid.VisibleColumns.Each(column =>
            {
                columns.Add(column.CreateSerializer().Serialize());
            });

            if (columns.Any())
            {
                writer.AppendCollection("columns", columns);
            }

            new GridPluginSerializer(grid).SerializeTo(writer);

            new GridUrlFormatSerializer <T>(grid).SerializeTo(writer);

            grid.Editing.SerializeTo("editing", writer);
            var shouldSerializeDataSource = false;

#if MVC2 || MVC3
            if (grid.OutputValidation)
            {
                writer.AppendObject("validationMetadata", grid.ValidationMetadata);
            }

            shouldSerializeDataSource = grid.Editing.Enabled && grid.IsClientBinding && !grid.IsEmpty;
#endif
            grid.Grouping.SerializeTo("grouping", writer);
            grid.Paging.SerializeTo("paging", writer);
            grid.Sorting.SerializeTo("sorting", writer);
            grid.Selection.SerializeTo("selection", writer);

            if (grid.DataBinding.IsClientOperationMode)
            {
                writer.Append("operationMode", "client");
                shouldSerializeDataSource = true;
            }

            grid.KeyboardNavigation.SerializeTo("keyboardNavigation", writer);
            grid.ColumnContextMenu.SerializeTo("columnContextMenu", writer);

            if (shouldSerializeDataSource)
            {
                grid.SerializeDataSource(writer);
            }

            grid.Ajax.SerializeTo("ajax", writer);
            grid.WebService.SerializeTo("ws", writer);
            grid.ClientEvents.SerializeTo("clientEvents", writer);
            grid.Localization.SerializeTo("localization", writer);
            if (grid.DetailView != null)
            {
                grid.DetailView.SerializeTo("detail", writer);
            }

            if (grid.ClientRowTemplate.HasValue())
            {
                writer.Append("rowTemplate", grid.IsSelfInitialized ? grid.ClientRowTemplate.Replace("<", "%3c").Replace(">", "%3e") : grid.ClientRowTemplate);
            }

            writer.Append("noRecordsTemplate", grid.NoRecordsTemplate);
        }
 public void SerializeTo(IClientSideObjectWriter writer)
 {
     writer.Append("multiple", Enabled, false);
     if (!Separator.Equals(defaultSeparator)) writer.Append("separator", Separator);
 }
Exemplo n.º 38
0
 public void SerializeTo(string key, IClientSideObjectWriter writer)
 {
     if (Enabled) {
         writer.Append("showOrOption", ShowOrOption, false);
     }
 }