Пример #1
0
        private void RegisterEditingScriptFiles()
        {
            ScriptFileNames.Add(ScriptRegistrar.jQueryValidation);
            if (Editing.Mode == GridEditMode.PopUp)
            {
                ScriptFileNames.Add("telerik.draganddrop.js");
                ScriptFileNames.Add("telerik.window.js");
            }
            ScriptFileNames.Add("telerik.grid.editing.js");

            if (Editing.Mode != GridEditMode.InLine)
            {
                var properties = typeof(T).GetProperties();

                if (properties.Where(p => p.PropertyType.IsDateTime()).Any())
                {
                    ScriptFileNames.Insert(1, "telerik.calendar.js");
                    ScriptFileNames.Insert(2, "telerik.datepicker.js");
                }

                if (properties.Where(p => p.PropertyType.IsDateTime()).Any())
                {
                    ScriptFileNames.Insert(1, "telerik.calendar.js");
                    ScriptFileNames.Insert(2, "telerik.datepicker.js");
                }

                if (properties.Where(p => p.PropertyType.IsNumericType()).Any())
                {
                    ScriptFileNames.Insert(1, "telerik.textbox.js");
                }
            }
        }
Пример #2
0
        public void RegisterScriptFiles()
        {
            if (Filtering.Enabled)
            {
                ScriptFileNames.Add("telerik.grid.filtering.js");
            }

            if (Editing.Enabled)
            {
                RegisterEditingScriptFiles();
            }

            if (Grouping.Enabled)
            {
                ScriptFileNames.Add("telerik.draganddrop.js");
                ScriptFileNames.Add("telerik.grid.grouping.js");
            }

            if (Resizing.Enabled)
            {
                ScriptFileNames.Add("telerik.draganddrop.js");
                ScriptFileNames.Add("telerik.grid.resizing.js");
            }

            if (Reordering.Enabled)
            {
                ScriptFileNames.Add("telerik.draganddrop.js");
                ScriptFileNames.Add("telerik.grid.reordering.js");
            }

            var dateColumns = Columns.OfType <IGridBoundColumn>().Where(c => c.MemberType.IsDateTime());

            if (dateColumns.Any())
            {
                ScriptFileNames.Insert(1, "telerik.calendar.js");
                ScriptFileNames.Insert(2, "telerik.datepicker.js");
            }

            var numericColumns = Columns.OfType <IGridBoundColumn>().Where(c => c.MemberType.IsNumericType());

            if (numericColumns.Any())
            {
                ScriptFileNames.Insert(1, "telerik.textbox.js");
            }
        }
Пример #3
0
        protected override void WriteHtml(HtmlTextWriter writer)
        {
            Guard.IsNotNull(writer, "writer");

            if (DragAndDrop.Enabled)
            {
                ScriptFileNames.Insert(1, "telerik.draganddrop.js");
            }

            ITreeViewHtmlBuilder builder = builderFactory.Create(this);

            IHtmlNode treeViewTag = builder.TreeViewTag();

            if (Items.Any())
            {
                if (SelectedIndex != -1 && Items.Count < SelectedIndex)
                {
                    throw new ArgumentOutOfRangeException(TextResource.IndexOutOfRange);
                }

                //this loop is required because of SelectedIndex feature.
                if (HighlightPath)
                {
                    Items.Each(HighlightSelectedItem);
                }

                Items.Each((item, index) =>
                {
                    if (!this.isPathHighlighted)
                    {
                        if (index == this.SelectedIndex)
                        {
                            item.Selected = true;

                            if (item.Items.Any() || item.Template.HasValue())
                            {
                                item.Expanded = true;
                            }
                        }
                    }

                    if (item.LoadOnDemand)
                    {
                        item.Expanded = false;
                    }

                    if (ExpandAll)
                    {
                        ExpandAllChildrens(item);
                    }

                    if (string.IsNullOrEmpty(item.Value))
                    {
                        item.Value = item.Text;
                    }

                    WriteItem(item, treeViewTag.Children[0], builder);
                });
            }

            treeViewTag.WriteTo(writer);

            base.WriteHtml(writer);
        }