Exemplo n.º 1
0
        private string GetToolBarOptions(JQGrid grid, bool subGrid, string pagerSelectorID)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (grid.ShowToolBar)
            {
                JsonToolBar      obj              = new JsonToolBar(grid.ToolBarSettings);
                string           json             = new JavaScriptSerializer().Serialize(obj);
                ClientSideEvents clientSideEvents = grid.ClientSideEvents;
                json = JsonUtil.RenderClientSideEvent(json, "beforeRefresh", clientSideEvents.BeforeRefresh);
                if (!subGrid)
                {
                    stringBuilder.AppendFormat(".navGrid('#{0}',{1},{2},{3},{4},{5} )", new object[]
                    {
                        grid.ID + "_pager",
                        //new JavaScriptSerializer().Serialize(obj),
                        json,
                        string.Format("jQuery('#{0}').getGridParam('editDialogOptions')", grid.ID),
                        string.Format("jQuery('#{0}').getGridParam('addDialogOptions')", grid.ID),
                        string.Format("jQuery('#{0}').getGridParam('delDialogOptions')", grid.ID),
                        string.Format("jQuery('#{0}').getGridParam('searchDialogOptions')", grid.ID),
                    });
                }
                else
                {
                    stringBuilder.AppendFormat(".navGrid('#' + pager_id,{0},{1},{2},{3},{4} )", new object[]
                    {
                        //new JavaScriptSerializer().Serialize(obj),
                        json,
                        "jQuery('#' + subgrid_table_id).getGridParam('editDialogOptions')",
                        "jQuery('#' + subgrid_table_id).getGridParam('addDialogOptions')",
                        "jQuery('#' + subgrid_table_id).getGridParam('delDialogOptions')",
                        "jQuery('#' + subgrid_table_id).getGridParam('searchDialogOptions')"
                    });
                }
                foreach (JQGridToolBarButton current in grid.ToolBarSettings.CustomButtons)
                {
                    if (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom || grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom)
                    {
                        JsonCustomButton jsonCustomButton = new JsonCustomButton(current);
                        stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID, jsonCustomButton.Process());
                    }
                    if (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom || grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top)
                    {
                        JsonCustomButton jsonCustomButton2 = new JsonCustomButton(current);
                        stringBuilder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID.Replace("_pager", "_toppager"), jsonCustomButton2.Process());
                    }
                }
                return(stringBuilder.ToString());
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
        public string Process()
        {
            SearchDialogSettings searchDialogSettings = this._grid.SearchDialogSettings;

            if (searchDialogSettings.TopOffset != 0)
            {
                this._jsonValues["top"] = searchDialogSettings.TopOffset;
            }
            if (searchDialogSettings.LeftOffset != 0)
            {
                this._jsonValues["left"] = searchDialogSettings.LeftOffset;
            }
            if (searchDialogSettings.Width != 300)
            {
                this._jsonValues["width"] = searchDialogSettings.Width;
            }
            if (searchDialogSettings.Height != 300)
            {
                this._jsonValues["height"] = searchDialogSettings.Height;
            }
            if (searchDialogSettings.Modal)
            {
                this._jsonValues["modal"] = true;
            }
            if (!searchDialogSettings.Draggable)
            {
                this._jsonValues["drag"] = false;
            }
            if (!string.IsNullOrEmpty(searchDialogSettings.FindButtonText))
            {
                this._jsonValues["Find"] = searchDialogSettings.FindButtonText;
            }
            if (!string.IsNullOrEmpty(searchDialogSettings.ResetButtonText))
            {
                this._jsonValues["Clear"] = searchDialogSettings.ResetButtonText;
            }
            if (searchDialogSettings.MultipleSearch)
            {
                this._jsonValues["multipleSearch"] = true;
            }
            //zhh
            if (searchDialogSettings.ShowQuery)
            {
                this._jsonValues["showQuery"] = true;
            }
            if (searchDialogSettings.ValidateInput)
            {
                this._jsonValues["checkInput"] = true;
            }
            if (!searchDialogSettings.Resizable)
            {
                this._jsonValues["resize"] = false;
            }
            if (searchDialogSettings.CloseOnEscape)
            {
                this._jsonValues["closeOnEscape"] = true;
            }
            this._jsonValues["recreateForm"] = true;
            //return new JavaScriptSerializer().Serialize(this._jsonValues);
            string           json             = new JavaScriptSerializer().Serialize(this._jsonValues);
            ClientSideEvents clientSideEvents = this._grid.ClientSideEvents;

            json = JsonUtil.RenderClientSideEvent(json, "beforeShowSearch", clientSideEvents.BeforeSearchDialogShown);
            return(JsonUtil.RenderClientSideEvent(json, "afterShowSearch", clientSideEvents.AfterSearchDialogShown));
        }
Exemplo n.º 3
0
        public string Process()
        {
            EditDialogSettings editDialogSettings = this._grid.EditDialogSettings;

            if (editDialogSettings.TopOffset != 0)
            {
                this._jsonValues["top"] = editDialogSettings.TopOffset;
            }
            if (editDialogSettings.LeftOffset != 0)
            {
                this._jsonValues["left"] = editDialogSettings.LeftOffset;
            }
            if (editDialogSettings.Width != 300)
            {
                this._jsonValues["width"] = editDialogSettings.Width;
            }
            if (editDialogSettings.Height != 300)
            {
                this._jsonValues["height"] = editDialogSettings.Height;
            }
            if (editDialogSettings.DataHeight != 0)
            {
                this._jsonValues["dataheight"] = editDialogSettings.DataHeight;
            }
            if (editDialogSettings.Modal)
            {
                this._jsonValues["modal"] = true;
            }
            if (!editDialogSettings.Draggable)
            {
                this._jsonValues["drag"] = false;
            }
            if (!string.IsNullOrEmpty(editDialogSettings.Caption))
            {
                this._jsonValues["editCaption"] = editDialogSettings.Caption;
            }
            if (!string.IsNullOrEmpty(editDialogSettings.SubmitText))
            {
                this._jsonValues["bSubmit"] = editDialogSettings.SubmitText;
            }
            if (!string.IsNullOrEmpty(editDialogSettings.CancelText))
            {
                this._jsonValues["bCancel"] = editDialogSettings.CancelText;
            }
            if (!string.IsNullOrEmpty(editDialogSettings.LoadingMessageText))
            {
                this._jsonValues["processData"] = editDialogSettings.LoadingMessageText;
            }
            if (editDialogSettings.CloseAfterEditing)
            {
                this._jsonValues["closeAfterEdit"] = true;
            }
            if (!editDialogSettings.ReloadAfterSubmit)
            {
                this._jsonValues["reloadAfterSubmit"] = false;
            }
            if (!editDialogSettings.Resizable)
            {
                this._jsonValues["resize"] = false;
            }
            if (editDialogSettings.CloseOnEscape)
            {
                this._jsonValues["closeOnEscape"] = true;
            }
            if (!string.IsNullOrEmpty(editDialogSettings.BottomInfo))
            {
                this._jsonValues["bottominfo"] = editDialogSettings.BottomInfo;
            }
            this._jsonValues["recreateForm"] = true;
            string           json             = new JavaScriptSerializer().Serialize(this._jsonValues);
            ClientSideEvents clientSideEvents = this._grid.ClientSideEvents;

            json = JsonUtil.RenderClientSideEvent(json, "beforeShowForm", clientSideEvents.BeforeEditDialogShown);
            json = JsonUtil.RenderClientSideEvent(json, "afterShowForm", clientSideEvents.AfterEditDialogShown);
            json = JsonUtil.RenderClientSideEvent(json, "afterComplete", clientSideEvents.AfterEditDialogRowInserted);
            json = JsonUtil.RenderClientSideEvent(json, "beforeSubmit", clientSideEvents.BeforeEditDialogSubmit);
            json = JsonUtil.RenderClientSideEvent(json, "beforeInitData", clientSideEvents.BeforeEditDialogInitData);
            json = JsonUtil.RenderClientSideEvent(json, "afterclickPgButtons", clientSideEvents.AfterClickPgButtons);
            json = JsonUtil.RenderClientSideEvent(json, "onclickSubmit", clientSideEvents.EditDialogOnClickSubmit);
            json = JsonUtil.RenderClientSideEvent(json, "onInitializeForm", clientSideEvents.EditDialogOnInitializeForm);
            json = JsonUtil.RenderClientSideEvent(json, "serializeEditData", clientSideEvents.EditDialogSerializeEditData);
            json = JsonUtil.RenderClientSideEvent(json, "beforeCheckValues", clientSideEvents.EditDialogBeforeCheckValues);
            json = JsonUtil.RenderClientSideEvent(json, "errorTextFormat", "function(data) { return '´íÎó: ' + data.responseText }");
            return(JsonUtil.RenderClientSideEvent(json, "editData", string.Format("{{ __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() }}", this._grid.ID)));
        }
Exemplo n.º 4
0
        public string Process()
        {
            DeleteDialogSettings deleteDialogSettings = this._grid.DeleteDialogSettings;

            if (deleteDialogSettings.TopOffset != 0)
            {
                this._jsonValues["top"] = deleteDialogSettings.TopOffset;
            }
            if (deleteDialogSettings.LeftOffset != 0)
            {
                this._jsonValues["left"] = deleteDialogSettings.LeftOffset;
            }
            if (deleteDialogSettings.Width != 300)
            {
                this._jsonValues["width"] = deleteDialogSettings.Width;
            }
            if (deleteDialogSettings.Height != 300)
            {
                this._jsonValues["height"] = deleteDialogSettings.Height;
            }
            if (deleteDialogSettings.Modal)
            {
                this._jsonValues["modal"] = true;
            }
            if (!deleteDialogSettings.Draggable)
            {
                this._jsonValues["drag"] = false;
            }
            if (!string.IsNullOrEmpty(deleteDialogSettings.SubmitText))
            {
                this._jsonValues["bSubmit"] = deleteDialogSettings.SubmitText;
            }
            if (!string.IsNullOrEmpty(deleteDialogSettings.CancelText))
            {
                this._jsonValues["bCancel"] = deleteDialogSettings.CancelText;
            }
            if (!string.IsNullOrEmpty(deleteDialogSettings.LoadingMessageText))
            {
                this._jsonValues["processData"] = deleteDialogSettings.LoadingMessageText;
            }
            if (!string.IsNullOrEmpty(deleteDialogSettings.Caption))
            {
                this._jsonValues["caption"] = deleteDialogSettings.Caption;
            }
            if (!string.IsNullOrEmpty(deleteDialogSettings.DeleteMessage))
            {
                this._jsonValues["msg"] = deleteDialogSettings.DeleteMessage;
            }
            if (!deleteDialogSettings.ReloadAfterSubmit)
            {
                this._jsonValues["reloadAfterSubmit"] = false;
            }
            if (!deleteDialogSettings.Resizable)
            {
                this._jsonValues["resize"] = false;
            }
            this._jsonValues["recreateForm"] = true;
            string           json             = new JavaScriptSerializer().Serialize(this._jsonValues);
            ClientSideEvents clientSideEvents = this._grid.ClientSideEvents;

            json = JsonUtil.RenderClientSideEvent(json, "beforeShowForm", clientSideEvents.BeforeDeleteDialogShown);
            json = JsonUtil.RenderClientSideEvent(json, "afterShowForm", clientSideEvents.AfterDeleteDialogShown);
            json = JsonUtil.RenderClientSideEvent(json, "afterComplete", clientSideEvents.AfterDeleteDialogRowDeleted);
            json = JsonUtil.RenderClientSideEvent(json, "beforeSubmit", clientSideEvents.BeforeDelDialogSubmit);
            json = JsonUtil.RenderClientSideEvent(json, "serializeDelData", clientSideEvents.SerializeDelData);
            json = JsonUtil.RenderClientSideEvent(json, "errorTextFormat", "function(data) { return '´íÎó: ' + data.responseText }");
            return(JsonUtil.RenderClientSideEvent(json, "delData", string.Format("{{ __RequestVerificationToken: jQuery('input[name=__RequestVerificationToken]').val() }}", this._grid.ID)));
        }