コード例 #1
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
        public virtual void InsertRecord(int index, object values, bool commit)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("insertRecord", index, values, commit);
        }
コード例 #2
0
        public void SetActive(bool active)
        {
            RequestManager.EnsureDirectEvent();

            this.AddScript("{0}.getFilter({1}).setActive({2});", this.Plugin.ClientID, JSON.Serialize(this.DataIndex), JSON.Serialize(active));
        }
コード例 #3
0
        public override void Flush()
        {
            string raw = this.html.ToString();

            StringBuilder buffer = new StringBuilder(256);

            DirectResponse ajaxResponse = new DirectResponse(true);
            HttpContext    context      = HttpContext.Current;

            object isUpdate = context.Items["Ext.Net.Direct.Update"];

            if (isUpdate != null && (bool)isUpdate)
            {
                this.ExtractUpdates(raw, buffer);
            }

            string dynamicHtml = this.ExtractDynamicHtml(raw);

            object isManual = context.Items["Ext.Net.Direct.Response.Manual"];

            if (isManual != null && (bool)isManual)
            {
                if (raw.StartsWith("<Ext.Net.Direct.Response.Manual>"))
                {
                    string script = dynamicHtml.ConcatWith(raw.RightOf("<Ext.Net.Direct.Response.Manual>").LeftOf("</Ext.Net.Direct.Response.Manual>"));
                    byte[] rsp    = System.Text.Encoding.UTF8.GetBytes(script);
                    this.response.Write(rsp, 0, rsp.Length);
                    this.response.Flush();
                    return;
                }
            }

            buffer.Append(dynamicHtml);

            string error = context == null ? null : (context.Error != null ? context.Error.ToString() : null);

            if (!ResourceManager.AjaxSuccess || error.IsNotEmpty())
            {
                ajaxResponse.Success = false;

                if (error.IsNotEmpty())
                {
                    ajaxResponse.ErrorMessage = error;
                }
                else
                {
                    ajaxResponse.ErrorMessage = ResourceManager.AjaxErrorMessage;
                }
            }
            else
            {
                if (ResourceManager.ReturnViewState)
                {
                    ajaxResponse.ViewState          = AjaxRequestFilter.GetHiddenInputValue(raw, BaseFilter.VIEWSTATE);
                    ajaxResponse.ViewStateEncrypted = AjaxRequestFilter.GetHiddenInputValue(raw, BaseFilter.VIEWSTATEENCRYPTED);
                    ajaxResponse.EventValidation    = AjaxRequestFilter.GetHiddenInputValue(raw, BaseFilter.EVENTVALIDATION);
                }

                object obj = ResourceManager.ServiceResponse;

                if (obj is Response)
                {
                    ajaxResponse.ServiceResponse = new ClientConfig().Serialize(obj);
                }
                else
                {
                    ajaxResponse.ServiceResponse = obj != null?JSON.Serialize(obj) : null;
                }

                if (ResourceManager.ExtraParamsResponse.Count > 0)
                {
                    ajaxResponse.ExtraParamsResponse = ResourceManager.ExtraParamsResponse.ToJson();
                }

                if (ResourceManager.DirectMethodResult != null)
                {
                    ajaxResponse.Result = ResourceManager.DirectMethodResult;
                }

                buffer.Append(raw.RightOf("<Ext.Net.Direct.Response>").LeftOf("</Ext.Net.Direct.Response>"));

                if (buffer.Length > 0)
                {
                    ajaxResponse.Script = "<string>".ConcatWith(buffer.ToString());
                }
            }

            bool isUpload = context != null && RequestManager.HasInputFieldMarker(context.Request);

            byte[] data = System.Text.Encoding.UTF8.GetBytes((isUpload ? "<textarea>" : "") + ajaxResponse.ToString() + (isUpload ? "</textarea>" : ""));
            this.response.Write(data, 0, data.Length);

            this.response.Flush();
        }
コード例 #4
0
        public virtual void RemoveByIndex(int index)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("removeByIndex", index);
        }
コード例 #5
0
        public virtual void RemoveByText(string text)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("removeByText", text);
        }
コード例 #6
0
        public virtual void AddRecord(IDictionary <string, object> values)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("addRecord", values);
        }
コード例 #7
0
        public virtual void AddItem(string text, object value)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("addItem", text, value);
        }
コード例 #8
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
 public virtual void StopEditing()
 {
     RequestManager.EnsureDirectEvent();
     this.Call("stopEditing");
 }
コード例 #9
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
 public virtual void UpdateCell(object id, string dataIndex, object value)
 {
     RequestManager.EnsureDirectEvent();
     this.AddScript("{0}.store.getById({1}).set({2},{3});", this.ClientID, JSON.Serialize(id), JSON.Serialize(dataIndex), JSON.Serialize(value));
 }
コード例 #10
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
 public virtual void StartEditing(int rowIndex, int colIndex)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("startEditing", rowIndex, colIndex);
 }
コード例 #11
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
 public virtual void StopEditing(bool cancel)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("stopEditing", cancel);
 }
コード例 #12
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
        internal virtual void SetHideHeaders(bool hide)
        {
            RequestManager.EnsureDirectEvent();

            this.AddScript("{0}.getView().mainHd.setDisplayed({1});", this.ClientID, JSON.Serialize(!hide));
        }
コード例 #13
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
        public virtual void DeleteSelected()
        {
            RequestManager.EnsureDirectEvent();

            this.Call("deleteSelected");
        }
コード例 #14
0
ファイル: GridPanelBase.cs プロジェクト: RabbWhite/ExtNet
        public virtual void AddRecord(object values, bool commit)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("addRecord", values, commit);
        }
コード例 #15
0
 public virtual void ScrollToTop()
 {
     RequestManager.EnsureDirectEvent();
     this.Call("scrollToTop");
 }
コード例 #16
0
 /// <summary>
 ///
 /// </summary>
 public virtual void RemoveAll()
 {
     RequestManager.EnsureDirectEvent();
     this.Call("removeAll");
 }
コード例 #17
0
 public virtual void InsertRecord(int index, IDictionary <string, object> values)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("insertRecord", index, values);
 }
コード例 #18
0
 public virtual void ClearFilters()
 {
     RequestManager.EnsureDirectEvent();
     this.Call("clearFilters");
 }
コード例 #19
0
        public virtual void InsertItem(int index, string text, object value)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("insertItem", index, text, value);
        }
コード例 #20
0
 /// <summary>
 /// Adds a filter to the collection and observes it for state change.
 /// </summary>
 /// <param name="filter">A filter configuration</param>
 public virtual void AddFilter(GridFilter filter)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("addFilter", new ClientConfig().Serialize(filter));
 }
コード例 #21
0
        public virtual void RemoveByField(string field, object value)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("removeByField", field, value);
        }
コード例 #22
0
 public virtual void FocusCell(int row, int col)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("focusCell", row, col);
 }
コード例 #23
0
        public virtual void RemoveByValue(string value)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("removeByValue", value);
        }
コード例 #24
0
 public virtual void FocusRow(int row)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("focusRow", row);
 }
コード例 #25
0
        public void UpdateData()
        {
            RequestManager.EnsureDirectEvent();

            this.AddScript("{0}={1};", this.ClientID, JSON.Serialize(this.Items));
        }
コード例 #26
0
 public virtual void Refresh(bool headersToo)
 {
     RequestManager.EnsureDirectEvent();
     this.Call("refresh", headersToo);
 }
コード例 #27
0
ファイル: KeyMap.cs プロジェクト: hhqqnu/Ext.NET.Community
        /// <summary>
        ///
        /// </summary>
        /// <param name="keyBinding"></param>
        public virtual void AddKeyBinding(KeyBinding keyBinding)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("addBinding", JRawValue.From(new ClientConfig().Serialize(keyBinding, true)));
        }
コード例 #28
0
 public virtual void Refresh()
 {
     RequestManager.EnsureDirectEvent();
     this.Call("refresh");
 }
コード例 #29
0
ファイル: KeyMap.cs プロジェクト: RabbWhite/ExtNet
        public void AddKeyBinding(KeyBinding keyBinding)
        {
            RequestManager.EnsureDirectEvent();

            this.Call("addBinding", new JRawValue(new ClientConfig().SerializeInternal(keyBinding, this)));
        }
コード例 #30
0
        public void SetValue(string[] value)
        {
            RequestManager.EnsureDirectEvent();

            this.AddScript("{0}.getFilter({1}).setValue({2});", this.Plugin.ClientID, JSON.Serialize(this.DataIndex), JSON.Serialize(value));
        }