예제 #1
0
파일: Q.Layout.cs 프로젝트: xareas/Serenity
 public static void TriggerLayoutOnShow(jQueryObject element)
 {
     LazyLoadHelper.ExecuteEverytimeWhenShown(element, () =>
     {
         element.TriggerHandler("layout");
     }, true);
 }
예제 #2
0
        public GoogleMap(jQueryObject container, GoogleMapOptions opt)
            : base(container, opt)
        {
            var center = new LatLng(options.Latitude ?? 0, options.Longitude ?? 0);

            map = new Map(container[0], new MapOptions
            {
                Center      = center,
                MapTypeId   = options.MapTypeId ?? MapTypeId.roadmap,
                Zoom        = options.Zoom ?? 15,
                ZoomControl = true
            });

            if (options.MarkerTitle != null)
            {
                new Marker(new MarkerOptions {
                    Position = new LatLng(
                        options.MarkerLatitude ?? options.Latitude ?? 0,
                        options.MarkerLongitude ?? options.Longitude ?? 0),
                    Map       = map,
                    Title     = options.MarkerTitle,
                    Animation = Animation.Drop
                });
            }

            LazyLoadHelper.ExecuteOnceWhenShown(container, () =>
            {
                GEvent.Trigger(map, "resize");
                map.SetCenter(center); // in case it wasn't visible (e.g. in dialog)
            });
        }
예제 #3
0
        public Flexify(jQueryObject container, FlexifyOptions options)
            : base(container, options)
        {
            var self = this;

            LazyLoadHelper.ExecuteOnceWhenShown(container, delegate {
                self.StoreInitialSize();
            });
        }
예제 #4
0
        public DataGrid(jQueryObject container, TOptions opt = null)
            : base(container, opt)
        {
            var self = this;

            this.element.AddClass("s-DataGrid").Html("");
            this.element.AddClass("s-" + this.GetType().Name);
            this.element.AddClass("require-layout").Bind("layout", delegate
            {
                self.Layout();
            });

            Title = GetInitialTitle();

            var buttons = GetButtons();

            if (buttons != null)
            {
                CreateToolbar(buttons);
            }

            this.slickContainer = CreateSlickContainer();

            this.view = CreateView();

            this.slickGrid = CreateSlickGrid();

            if (UsePager())
            {
                CreatePager();
            }

            BindToSlickEvents();
            BindToViewEvents();

            if (buttons != null)
            {
                CreateToolbarExtensions();
            }

            UpdateDisabledState();

            if (PopulateWhenVisible())
            {
                LazyLoadHelper.ExecuteEverytimeWhenShown(element, () => self.RefreshIfNeeded(), false);
                if (element.Is(":visible"))
                {
                    view.Populate();
                }
            }
            else
            {
                view.Populate();
            }
        }
예제 #5
0
        protected void InitialPopulate()
        {
            var self = this;

            if (PopulateWhenVisible())
            {
                LazyLoadHelper.ExecuteEverytimeWhenShown(element, () => self.RefreshIfNeeded(), false);
                if (element.Is(":visible"))
                {
                    view.Populate();
                }
            }
            else
            {
                view.Populate();
            }
        }
        public HtmlContentEditor(jQueryObject textArea, HtmlContentEditorOptions opt)
            : base(textArea, opt)
        {
            IncludeCKEditor();

            string id = textArea.GetAttribute("id");

            if (id.IsTrimmedEmpty())
            {
                textArea.Attribute("id", this.uniqueName);
                id = this.uniqueName;
            }

            if (options.Cols != null)
            {
                textArea.Attribute("cols", options.Cols.Value.ToString());
            }

            if (options.Rows != null)
            {
                textArea.Attribute("rows", options.Rows.Value.ToString());
            }

            var self = this;

            this.AddValidationRule(this.uniqueName, e =>
            {
                if (e.HasClass("required"))
                {
                    var value = self.Value.TrimToNull();
                    if (value == null)
                    {
                        return(Q.Text("Validation.Required"));
                    }
                }

                return(null);
            });

            LazyLoadHelper.ExecuteOnceWhenShown(this.element, () =>
            {
                var config = GetConfig();
                CKEditor.Replace(id, config);
            });
        }