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(); } }
public static void AddIncludeDeletedToggle <TEntity>(jQueryObject toolDiv, SlickRemoteView <TEntity> view, string hint = null, bool initial = false) { bool includeDeleted = false; var oldSubmit = view.OnSubmit; view.OnSubmit = (v) => { v.Params.IncludeDeleted = includeDeleted; if (oldSubmit != null) { return(oldSubmit(v)); } return(true); }; AddToggleButton(toolDiv, cssClass: "s-IncludeDeletedToggle", initial: initial, hint: hint ?? "silinmiş kayıtları da göster", callback: (pressed) => { includeDeleted = pressed; view.SeekToPage = 1; view.Populate(); }); toolDiv.Bind("remove", delegate { view.OnSubmit = null; oldSubmit = null; }); }
protected void InitialPopulate() { var self = this; if (PopulateWhenVisible()) { LazyLoadHelper.ExecuteEverytimeWhenShown(element, () => self.RefreshIfNeeded(), false); if (element.Is(":visible")) { view.Populate(); } } else { view.Populate(); } }
public static void AddQuickSearchInput <TEntity>(jQueryObject toolDiv, SlickRemoteView <TEntity> view, List <QuickSearchField> fields = null) { var oldSubmit = view.OnSubmit; var searchText = ""; var searchField = ""; view.OnSubmit = (v) => { if (searchText != null && searchText.Length > 0) { v.Params.ContainsText = searchText; } else { Script.Delete(v.Params, "ContainsText"); } if (searchField != null && searchField.Length > 0) { v.Params.ContainsField = searchField; } else { Script.Delete(v.Params, "ContainsField"); } if (oldSubmit != null) { return(oldSubmit(v)); } return(true); }; Action <bool> lastDoneEvent = null; AddQuickSearchInputCustom(toolDiv, delegate(string field, string query, Action <bool> done) { searchText = query; searchField = field; view.SeekToPage = 1; lastDoneEvent = done; view.Populate(); }, fields); view.OnDataLoaded.Subscribe((e, ui) => { if (lastDoneEvent != null) { lastDoneEvent(view.Rows.Count > 0); lastDoneEvent = null; } }); }
public static void AddQuickSearchInput <TEntity>(jQueryObject toolDiv, SlickRemoteView <TEntity> view, List <QuickSearchField> fields = null) { var oldSubmit = view.OnSubmit; var searchText = ""; var searchField = ""; view.OnSubmit = (v) => { if (searchText != null && searchText.Length > 0) { v.Params.ContainsText = searchText; } else { Script.Delete(v.Params, "ContainsText"); } if (searchField != null && searchField.Length > 0) { v.Params.ContainsField = searchField; } else { Script.Delete(v.Params, "ContainsField"); } if (oldSubmit != null) { return(oldSubmit(v)); } return(true); }; AddQuickSearchInputCustom(toolDiv, delegate(string field, string query) { searchText = query; searchField = field; view.SeekToPage = 1; view.Populate(); }, fields); }
protected virtual void InternalRefresh() { view.Populate(); }