Esempio n. 1
0
 public static void TriggerLayoutOnShow(jQueryObject element)
 {
     LazyLoadHelper.ExecuteEverytimeWhenShown(element, () =>
     {
         element.TriggerHandler("layout");
     }, true);
 }
Esempio n. 2
0
        public static void InitFullHeightGridPage(jQueryObject gridDiv)
        {
            J("body")
            .AddClass("full-height-page");

            jQueryEventHandler layout = delegate
            {
                if (gridDiv.Parent().HasClass("page-content"))
                {
                    gridDiv.CSS("height", "1px")
                    .CSS("overflow", "hidden");
                }

                Q.LayoutFillHeight(gridDiv);
                gridDiv.TriggerHandler("layout");
            };

            if (Window.Instance.As <dynamic>().Metronic != null)
            {
                Window.Instance.As <dynamic>().Metronic.addResizeHandler(layout);
            }
            else
            {
            }
            //jQuery.Window.Resize(layout);


            layout(null);
        }
Esempio n. 3
0
        public static void InitFullHeightGridPage(jQueryObject gridDiv)
        {
            J("body")
                .AddClass("full-height-page");

            jQueryEventHandler layout = delegate
            {
                if (gridDiv.Parent().HasClass("page-content"))
                    gridDiv.CSS("height", "1px")
                        .CSS("overflow", "hidden");

                Q.LayoutFillHeight(gridDiv);
                gridDiv.TriggerHandler("layout");
            };

            if (J("body").HasClass("has-layout-event"))
            {
                J("body").Bind("layout", layout);
            }
            else if (Window.Instance.As<dynamic>().Metronic != null)
                Window.Instance.As<dynamic>().Metronic.addResizeHandler(layout);
            else
            {
                jQuery.Window.Resize(layout);
            }

            layout(null);
        }
Esempio n. 4
0
        public static void InitFullHeightGridPage(jQueryObject gridDiv)
        {
            J("body")
            .AddClass("full-height-page");

            gridDiv.AddClass("responsive-height");

            jQueryEventHandler layout = delegate
            {
                bool inPageContent = gridDiv.Parent().HasClass("page-content") ||
                                     gridDiv.Parent().Is("section.content");

                if (inPageContent)
                {
                    gridDiv.CSS("height", "1px")
                    .CSS("overflow", "hidden");
                }

                Q.LayoutFillHeight(gridDiv);

                if (inPageContent)
                {
                    gridDiv.CSS("overflow", "");
                }

                gridDiv.TriggerHandler("layout");
            };

            if (J("body").HasClass("has-layout-event"))
            {
                J("body").Bind("layout", layout);
            }
            else if (Window.Instance.As <dynamic>().Metronic != null)
            {
                Window.Instance.As <dynamic>().Metronic.addResizeHandler(layout);
            }
            else
            {
                jQuery.Window.Resize(layout);
            }

            layout(null);
        }
Esempio n. 5
0
        private void ResizeElement(jQueryObject element)
        {
            var xFactor = GetXFactor(element);

            if (xFactor != 0)
            {
                var initialWidth = element.GetDataValue("flexify-width").As <int?>();
                if (initialWidth == null)
                {
                    var width = element.GetWidth();
                    element.Data("flexify-width", width);
                    initialWidth = width;
                }

                element.Width(Math.Truncate(initialWidth.Value + xFactor * xDifference));
            }

            var yFactor = GetYFactor(element);

            if (yFactor != 0)
            {
                var initialHeight = element.GetDataValue("flexify-height").As <int?>();
                if (initialHeight == null)
                {
                    var height = element.GetHeight();
                    element.Data("flexify-height", height);
                    initialHeight = height;
                }

                element.Height(Math.Truncate(initialHeight.Value + yFactor * yDifference));
            }

            if (element.HasClass("require-layout"))
            {
                element.TriggerHandler("layout");
            }
        }
Esempio n. 6
0
        public DateTimeEditor(jQueryObject input, DateTimeEditorOptions opt)
            : base(input, opt)
        {
            input.AddClass("dateQ s-DateTimeEditor")
            .DatePicker(new DatePickerOptions
            {
                ShowOn     = "button",
                BeforeShow = new Func <bool>(delegate
                {
                    return(!input.HasClass("readonly"));
                }),
                YearRange = options.YearRange ?? "-100:+50"
            });

            input.Bind("keyup." + this.uniqueName, e => {
                if (e.Which == 32 && !ReadOnly)
                {
                    if (this.ValueAsDate != JsDate.Now)
                    {
                        this.ValueAsDate = JsDate.Now;
                        this.element.Trigger("change");
                    }
                }
                else
                {
                    DateEditor.DateInputKeyup(e);
                }
            });
            input.Bind("change." + this.uniqueName, DateEditor.DateInputChange);

            time = J("<select/>").AddClass("editor s-DateTimeEditor time");
            var after = input.Next(".ui-datepicker-trigger");

            if (after.Length > 0)
            {
                time.InsertAfter(after);
            }
            else
            {
                after = input.Prev(".ui-datepicker-trigger");
                if (after.Length > 0)
                {
                    time.InsertBefore(after);
                }
                else
                {
                    time.InsertAfter(input);
                }
            }

            foreach (var t in GetTimeOptions(fromHour: options.StartHour ?? 0,
                                             toHour: options.EndHour ?? 23,
                                             stepMins: options.IntervalMinutes ?? 5))
            {
                Q.AddOption(time, t, t);
            }

            input.AddValidationRule(this.uniqueName, e =>
            {
                var value = this.Value;
                if (string.IsNullOrEmpty(value))
                {
                    return(null);
                }

                if (!string.IsNullOrEmpty(MinValue) &&
                    String.Compare(value, MinValue) < 0)
                {
                    return(String.Format(Q.Text("Validation.MinDate"),
                                         Q.FormatDate(MinValue)));
                }

                if (!string.IsNullOrEmpty(MaxValue) &&
                    String.Compare(value, MaxValue) >= 0)
                {
                    return(String.Format(Q.Text("Validation.MaxDate"),
                                         Q.FormatDate(MaxValue)));
                }

                return(null);
            });

            SqlMinMax = true;

            J("<div class='inplace-button inplace-now'><b></b></div>")
            .Attribute("title", "set to now")
            .InsertAfter(time)
            .Click(e =>
            {
                if (this.Element.HasClass("readonly"))
                {
                    return;
                }

                this.ValueAsDate = JsDate.Now;
            });

            time.On("change", e => input.TriggerHandler("change"));
        }
Esempio n. 7
0
 public static jQueryObject TriggerDataChange(this jQueryObject element)
 {
     element.TriggerHandler("ondatachange");
     return(element);
 }
Esempio n. 8
0
 public static void TriggerLayoutOnShow(jQueryObject element)
 {
     LazyLoadHelper.ExecuteEverytimeWhenShown(element, () =>
     {
         element.TriggerHandler("layout");
     }, true);
 }