예제 #1
0
        private string GetToolBarOptions(JQGrid grid, bool subGrid, string pagerSelectorID)
        {
            StringBuilder builder = new StringBuilder();

            if (!grid.ShowToolBar)
            {
                return(string.Empty);
            }
            JsonToolBar bar = new JsonToolBar(grid.ToolBarSettings);

            if (!subGrid)
            {
                builder.AppendFormat(".navGrid('#{0}',{1},{2},{3},{4},{5} )", new object[] { grid.ID + "_pager", new JavaScriptSerializer().Serialize(bar), 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
            {
                builder.AppendFormat(".navGrid('#' + pager_id,{0},{1},{2},{3},{4} )", new object[] { new JavaScriptSerializer().Serialize(bar), "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 button in grid.ToolBarSettings.CustomButtons)
            {
                builder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID, new JsonCustomButton(button).Process());
            }
            builder.Append(";");
            return(builder.ToString());
        }
예제 #2
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);
        }
예제 #3
0
 private string GetToolBarOptions(JQGrid grid, bool subGrid, string pagerSelectorID)
 {
     StringBuilder builder = new StringBuilder();
     if (!grid.ShowToolBar)
     {
         return string.Empty;
     }
     JsonToolBar bar = new JsonToolBar(grid.ToolBarSettings);
     if (!subGrid)
     {
         builder.AppendFormat(".navGrid('#{0}',{1},{2},{3},{4},{5} )", new object[] { grid.ID + "_pager", new JavaScriptSerializer().Serialize(bar), 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
     {
         builder.AppendFormat(".navGrid('#' + pager_id,{0},{1},{2},{3},{4} )", new object[] { new JavaScriptSerializer().Serialize(bar), "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 button in grid.ToolBarSettings.CustomButtons)
     {
         if ((grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Bottom) || (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom))
         {
             builder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID, new JsonCustomButton(button).Process());
         }
         if ((grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.TopAndBottom) || (grid.ToolBarSettings.ToolBarPosition == ToolBarPosition.Top))
         {
             builder.AppendFormat(".navButtonAdd({0},{1})", pagerSelectorID.Replace("_pager", "_toppager"), new JsonCustomButton(button).Process());
         }
     }
     return builder.ToString();
 }