Ejemplo n.º 1
0
        /// <summary>
        /// 初始化自动增加的隐藏项(主键项或删除标识项)
        /// </summary>
        /// <param name="prefix"></param>
        /// <param name="key"></param>
        /// <param name="havecount"></param>
        /// <param name="grid"></param>
        private void IniAddGridColumn(string prefix, string key, int havecount, Ext.Net.GridPanel grid)
        {
            Model model = grid.GetStore().ModelInstance;

            if (!string.IsNullOrWhiteSpace(key))
            {
                bool isExist = false;
                foreach (GridColumn column in uiHelper.Select.MainGrid.Columns)
                {
                    if (key.Equals(column.ColumnName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        column.ColumnName = key;
                        isExist           = true;
                        break;
                    }
                }
                if (!isExist)
                {
                    GridColumn column = new GridColumn();
                    column.Caption    = key;
                    column.ColumnName = key;
                    column.IsShow     = false;
                    ModelField mField = new ModelField();
                    mField.Name = column.ColumnName;
                    model.Fields.Add(mField);
                    if (column.IsShow)
                    {
                        CellCommandColumn cell = IniGridColumn(prefix, column);
                        grid.ColumnModel.Columns.Insert(grid.ColumnModel.Columns.Count - havecount, cell);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void AfterItemRemove(AbstractComponent item)
        {
            GridPanel grid = this.ParentGrid;

            if (grid != null)
            {
                if (grid.Controls.Contains(item))
                {
                    grid.Controls.Remove(item);
                }

                if (grid.LazyItems.Contains(item))
                {
                    grid.LazyItems.Remove(item);
                }
            }
        }
Ejemplo n.º 3
0
        protected internal override void PluginAdded()
        {
            base.PluginAdded();

            GridPanel grid = this.PluginOwner as GridPanel;

            if (grid == null)
            {
                throw new InvalidOperationException("The RowExpander plugin can only be added to the GridPanel Control or a Control which inherits from GridPanel.");
            }

            if (!this.PluginOwner.Controls.Contains(this.Template))
            {
                this.PluginOwner.Controls.Add(this.Template);
            }

            if (!this.PluginOwner.LazyItems.Contains(this.Template))
            {
                this.PluginOwner.LazyItems.Add(this.Template);
            }

            if (this.Component.Count > 0)
            {
                if (!this.PluginOwner.Controls.Contains(this.Component[0]))
                {
                    this.PluginOwner.Controls.Add(this.Component[0]);
                }

                if (!this.PluginOwner.LazyItems.Contains(this.Component[0]))
                {
                    this.PluginOwner.LazyItems.Add(this.Component[0]);
                }
            }

            if (this.Page == null)
            {
                this.Init += new EventHandler(RowExpander_Init);
                return;
            }

            this.InitRowExpanderColumn(grid);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        protected internal override void FeatureAdded()
        {
            base.FeatureAdded();

            GridPanel grid = this.ParentComponent as GridPanel;

            //if (!RequestManager.IsAjaxRequest && grid != null)
            //{
            //    if (grid.StoreID.IsNotEmpty() || grid.Store.Primary != null)
            //    {
            //        Store store = grid.Store.Primary ?? (ControlUtils.FindControl(this, grid.StoreID) as Store);

            //        if (store != null && store.IsProxyDefined && store.RemotePaging && this.State["Local"] == null)
            //        {
            //            this.Local = false;
            //        }
            //    }
            //}

            if (grid != null)
            {
                foreach (GridFilter filter in this.Filters)
                {
                    if (filter.MenuItems.Count > 0)
                    {
                        foreach (AbstractComponent item in filter.MenuItems)
                        {
                            if (!grid.Controls.Contains(item))
                            {
                                grid.Controls.Add(item);
                            }

                            if (!grid.LazyItems.Contains(item))
                            {
                                grid.LazyItems.Add(item);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected internal override void PluginAdded()
        {
            base.PluginAdded();

            GridPanel grid = this.PluginOwner as GridPanel;

            if (grid == null)
            {
                throw new InvalidOperationException("The RowExpander plugin can only be added to the GridPanel Control or a Control which inherits from GridPanel.");
            }

            if (!this.PluginOwner.Controls.Contains(this.Template))
            {
                this.PluginOwner.Controls.Add(this.Template);
            }

            if (!this.PluginOwner.LazyItems.Contains(this.Template))
            {
                this.PluginOwner.LazyItems.Add(this.Template);
            }

            if (this.Component.Count > 0)
            {
                if (!this.PluginOwner.Controls.Contains(this.Component[0]))
                {
                    this.PluginOwner.Controls.Add(this.Component[0]);
                }

                if (!this.PluginOwner.LazyItems.Contains(this.Component[0]))
                {
                    this.PluginOwner.LazyItems.Add(this.Component[0]);
                }
            }

            if (this.Loader != null && this.PluginOwner != null)
            {
                this.Loader.EnableViewState = this.DesignMode;
                this.PluginOwner.Controls.Add(this.Loader);
                this.PluginOwner.LazyItems.Add(this.Loader);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 初始化查询 明细列表
        /// </summary>
        /// <param name="grid"></param>
        public void IniSelectDetailGrid(Ext.Net.GridPanel grid)
        {
            #region 分页每页数量
            var pagesize = uiHelper.Select.DetailGrid.PageSize;
            if (pagesize <= 0)
            {
                pagesize = 15;
            }
            grid.GetStore().PageSize = pagesize;
            #endregion
            string prefix = UiControlNamePrefix.SelectDetailGrid;
            Model  model  = grid.GetStore().ModelInstance;
            #region 网格条数信息
            int havecount = grid.ColumnModel.Columns.Count;
            RowNumbererColumn numbercol = new RowNumbererColumn();
            numbercol.Width = 40;
            grid.ColumnModel.Columns.Insert(grid.ColumnModel.Columns.Count - havecount, numbercol);
            #endregion


            #region 添加设置字段
            foreach (GridColumn column in uiHelper.Select.DetailGrid.Columns)
            {
                ModelField mField = new ModelField();
                mField.Name = column.ColumnName;
                if (column.ColumnType == GridColumnType.Date)
                {
                    mField.Type = ModelFieldType.Date;
                }
                model.Fields.Add(mField);
                if (column.IsShow)
                {
                    CellCommandColumn cell = IniGridColumn(prefix, column);
                    grid.ColumnModel.Columns.Insert(grid.ColumnModel.Columns.Count - havecount, cell);
                }
            }
            #endregion
        }
Ejemplo n.º 7
0
        public override Button GetToolbarButton(ContentItem contentItem, GridPanel gridPanel)
        {
            Button toolbarButton = new Button
            {
                Text = "Delete",
                Icon = Icon.Delete,
                Disabled = true
            };

            toolbarButton.Listeners.Click.Handler = string.Format(@"
                var selections = {0}.getSelectionModel().getSelections();
                var selectedIDs = [];
                for (var i = 0; i < selections.length; i++)
                {{
                    var record = selections[i];
                    selectedIDs.push(record.data.ID);
                }}
                top.Ext.net.DirectMethods.Delete.ShowDialog('Delete Items',
                    'Are you sure you wish to delete these items?',
                    selectedIDs.join(','), {{ url : '{1}' }});",
                gridPanel.ClientID, Context.AdminManager.GetAdminDefaultUrl());

            return toolbarButton;
        }
Ejemplo n.º 8
0
        private void InitComponent()
        {
            btnCarry_out_action_message = new Button {
                Icon = Icon.ControllerAdd, Text = " Carry Out Action Message",
            };

            #region Grid + Batch
            strBatchs = new Store
            {
                ID           = "strBatchs",
                AutoDataBind = true,
                Model        =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "UID"
                            },
                            new ModelField {
                                Name = "Worksheet_Template_Name"
                            },
                            new ModelField {
                                Name = "Name"
                            },
                            new ModelField {
                                Name = "Description"
                            },
                            new ModelField {
                                Name = "Template_Type"
                            },
                            new ModelField {
                                Name = "Recurring", Type = ModelFieldType.Boolean
                            },
                            new ModelField {
                                Name = "Company"
                            }
                        }
                    }
                }
            };
            cboBatchs = new SelectBox
            {
                ID           = "cboBatchs",
                DisplayField = "Name",
                ValueField   = "Name",
                EmptyText    = "Select a batch...",
                Width        = 125
            };
            cboBatchs.Store.Add(strBatchs);

            strItems = new Store
            {
                ID    = "strItems",
                Model =
                {
                    new Model              {
                        IDProperty = "Key",
                        Fields     =
                        {
                            new ModelField {
                                Name = "Type"
                            },
                            new ModelField {
                                Name = "No"
                            },
                            new ModelField {
                                Name = "Action_Message"
                            },
                            new ModelField {
                                Name = "Accept_Action_Message"
                            },
                            new ModelField {
                                Name = "Description"
                            },
                            new ModelField {
                                Name = "Description2"
                            },
                            new ModelField {
                                Name = "Description_2"
                            },
                            new ModelField {
                                Name = "Vietnamese_Description"
                            },
                            new ModelField {
                                Name = "Location_Code"
                            },
                            new ModelField {
                                Name = "Shortcut_Dimension_1_Code"
                            },
                            new ModelField {
                                Name = "Shortcut_Dimension_2_Code"
                            },
                            new ModelField {
                                Name = "Quantity"
                            },
                            new ModelField {
                                Name = "Unit_of_Measure_Code"
                            },
                            new ModelField {
                                Name = "Direct_Unit_Cost"
                            },
                            new ModelField {
                                Name = "Due_Date"
                            },
                            new ModelField {
                                Name = "Vendor_No"
                            },
                            new ModelField {
                                Name = "Vendor_Item_No"
                            },
                            new ModelField {
                                Name = "Replenishment_System"
                            }
                        }
                    }
                },

                //Sorters = {
                //    new DataSorter { Property="Converted", Direction = SortDirection.DESC },
                //    new DataSorter { Property="Due_Date", Direction = SortDirection.DESC }
                //}
            };
            grdItems = new GridPanel
            {
                ID          = "grdItems",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column       {
                            DataIndex = "Type",                      Text = "Type",                   Width = 90
                        },
                        new Column       {
                            DataIndex = "No",                        Text = "No",                     Width = 150
                        },
                        new Column       {
                            DataIndex = "Action_Message",            Text = "Action Message",         Width = 150
                        },
                        new Column       {
                            DataIndex = "Accept_Action_Message",     Text = "Accept Action Message",  Width = 150
                        },
                        new Column       {
                            DataIndex = "Description",               Text = "Description",            Width = 200, Flex   =            1, MinWidth = 200
                        },
                        new Column       {
                            DataIndex = "Description_2",             Text = "Description 2",          Width = 200, Flex   =            1, MinWidth = 200
                        },
                        new Column       {
                            DataIndex = "Vietnamese_Description",    Text = "Vietnamese Description", Width = 200, Flex   =            1, MinWidth = 200
                        },
                        new Column       {
                            DataIndex = "Location_Code",             Text = "Location Code",          Width = 120
                        },
                        new Column       {
                            DataIndex = "Shortcut_Dimension_1_Code", Text = "Entity Code",            Width = 120
                        },
                        new NumberColumn {
                            DataIndex = "Quantity",                  Text = "Quantity",               Width = 120, Format = "0,000.00",   Align    = Alignment.Right
                        },
                        new Column       {
                            DataIndex = "Unit_of_Measure_Code",      Text = "UOM Code",               Width = 100
                        },
                        new NumberColumn {
                            DataIndex = "Direct_Unit_Cost",          Text = "Direct Unit Cost",       Width = 120, Format = "0,000.00",   Align    = Alignment.Right
                        },
                        new DateColumn   {
                            DataIndex = "Due_Date",                  Text = "Due Date",               Width = 120, Format = "dd/MM/yyyy", Align    = Alignment.Left
                        },
                        new Column       {
                            DataIndex = "Vendor_No",                 Text = "Vendor_No",              Width = 150
                        },
                        new Column       {
                            DataIndex = "Vendor_Item_No",            Text = "Vendor Item No",         Width = 150
                        },
                        new Column       {
                            DataIndex = "Replenishment_System",      Text = "Replenishment_System",   Width = 100
                        },
                    }
                },
                TopBar =
                {
                    new Toolbar {
                        Items =
                        {
                            cboBatchs, btnCarry_out_action_message,
                            new ToolbarFill()
                        }
                    }
                },
                Plugins   = { new FilterHeader {
                              } },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel =
                {
                    new RowSelectionModel {
                        //Mode = SelectionMode.Single
                        Mode = SelectionMode.Multi
                    }
                },
            };
            grdItems.Store.Add(strItems);

            ModelField StatusType = grdItems.Store[0].Model[0].Fields.FirstOrDefault(i => i.Name == "Action_Message");
            StatusType.Convert.Fn = SCOPE + ".Convert_ActionMessage_List";

            ModelField ReplenishmentSystem = grdItems.Store[0].Model[0].Fields.FirstOrDefault(i => i.Name == "Replenishment_System");
            ReplenishmentSystem.Convert.Fn = SCOPE + ".Convert_ReplenishmentSystem_List";
            #endregion

            #region Panel
            Panel center = new Panel
            {
                Layout = "Fit",
                Region = Region.Center,
                Items  = { grdItems }
            };
            Panel pnlLeft = new Panel
            {
                Width       = 250,
                Title       = "Menu",
                Collapsible = true,
                Collapsed   = true,
                Region      = Region.West,
                Layout      = "VBoxLayout",
                Items       =
                {
                    new Ext.Net.HyperLink {
                        Width       = 250,
                        Icon        = Icon.Accept,
                        Target      = "_blank",
                        NavigateUrl = "../../login.aspx",
                        Text        = "Relogin"
                    },

                    new Ext.Net.HyperLink {
                        Width       = 250,
                        Icon        = Icon.PackageGo,
                        Target      = "_blank",
                        NavigateUrl = "../PurchaseOrder",
                        Text        = "Purchase Order"
                    },

                    new Ext.Net.HyperLink {
                        Width       = 250,
                        Icon        = Icon.PackageGo,
                        Target      = "_blank",
                        NavigateUrl = "../ReqWorksheet",
                        Text        = "Req. Worksheets"
                    }
                }
            };
            #endregion

            #region Viewport
            this.ID     = "pageMain";
            this.Layout = "BorderLayout";
            this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> {
                pnlLeft, center
            });
            #endregion
        }
Ejemplo n.º 9
0
 public void InitRowExpanderColumn(GridPanel grid)
 {
     grid.ColumnModel.Columns.Insert(this.ColumnPosition, new ReferenceColumn(this.ClientID));
 }
Ejemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="g"></param>
 /// <param name="modelFieldCollection"></param>
 public static void BindStoreFields(this GridPanel g, IList <ModelField> modelFieldCollection)
 {
     g.GetStore().Fields.AddRange(modelFieldCollection);
 }
Ejemplo n.º 11
0
        private void InitComponent()
        {
            #region Button
            btnAddUser = new Button {
                ID = "btnAddUser", Text = "Add User", Icon = Icon.UserAdd
            };
            btnDelete = new Button {
                ID = "btnDelete", Text = "Delete User", Icon = Icon.UserDelete
            };
            #endregion Button

            #region Card
            txtUserName = new TextField
            {
                ID         = "txtUserName",
                EmptyText  = "Enter username",
                Flex       = 1,
                LabelWidth = 80,
                FieldLabel = "Username",
                AllowBlank = false
            };

            txtFullName = new TextField
            {
                ID         = "txtFullName",
                EmptyText  = "Enter full name",
                Flex       = 1,
                LabelWidth = 80,
                FieldLabel = "Full name",
                AllowBlank = false
            };

            cbgCinema = new CheckboxGroup
            {
                ID            = "cbgCinema",
                FieldLabel    = "Cinema",
                ColumnsNumber = 3,
                Cls           = "x-check-group-alt"
            };

            cboLocation = new ComboBox
            {
                ID         = "cboLocation",
                FieldLabel = "Location",
                EmptyText  = "Enter Location",
                Flex       = 1,
                LabelWidth = 80,
                AllowBlank = false
            };

            cboBatch = new ComboBox
            {
                ID         = "cboBatch",
                EmptyText  = "Enter Batch",
                Flex       = 1,
                LabelWidth = 80,
                FieldLabel = "Batch",
                AllowBlank = false
            };

            rdgRole = new RadioGroup
            {
                ID            = "rdgRole",
                FieldLabel    = "Role",
                ColumnsNumber = 1,
                Items         =
                {
                    new Radio {
                        ID = "rdoAdmin", BoxLabel = "Admin", Value = "Admin", InputValue = "Admin"
                    },
                    new Radio {
                        ID = "rdoFnb", BoxLabel = "F&B", Value = "FnB", InputValue = "FnB"
                    },
                    new Radio {
                        ID = "rdoAccSite", BoxLabel = "Accounting Site", Value = "AccSite", InputValue = "AccSite", Checked = true
                    },
                    new Radio {
                        ID = "rdoCM", BoxLabel = "Cinema Manager", Value = "CM", InputValue = "CM"
                    }
                }
            };

            cboCompanyCard = new ComboBox {
                ID         = "cboCompanyCard",
                EmptyText  = "Enter company",
                Flex       = 1,
                LabelWidth = 80,
                FieldLabel = "Company",
                AllowBlank = false
            };
            #endregion

            #region Account
            strUsername = new Store
            {
                ID    = "strUsername",
                Model =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "Account"
                            },
                            new ModelField {
                                Name = "Fullname"
                            },
                        }
                    }
                }
            };

            cboUsername = new Ext.Net.ComboBox
            {
                DataIndex     = "Account",
                Name          = "Account",
                LabelWidth    = 80,
                Anchor        = "100%",
                FieldLabel    = "Account",
                ID            = "cboUsername",
                SelectOnFocus = true,
                AllowBlank    = false,
                MsgTarget     = MessageTarget.Side,
                DisplayField  = "Account",
                ValueField    = "Account",
                PageSize      = 100,
            };
            cboUsername.Store.Add(strUsername);
            cboUsername.ListConfig = new BoundList {
                Width        = 320,
                Height       = 300,
                ItemSelector = ".x-boundlist-item",
                Tpl          = new XTemplate {
                    Html = string.Format(@"
                    <Html>
					    <tpl for=""."">
						    <tpl if=""[xindex] == 1"">
							    <table class=""cbStates-list"">
								    <tr>
									<th style =""font-weight: bold;padding: 3px;background: #3892d3"">{0}</th> 
                                    <th style =""font-weight: bold;padding: 3px;background: #3892d3"">{1}</th>   
								    </tr>
						    </tpl>
						    <tr class=""x-boundlist-item"">
							    <td style=""padding:3px;"">{{{0}}}</td>    
                                <td style=""padding:3px;"">{{{1}}}</td> 
						    </tr>
						    <tpl if=""[xcount-xindex]==0"">
							    </table>
						    </tpl>
					    </tpl>
				    </Html>"                , "Account", "Fullname")
                }
            };
            cboUsername.Triggers.Add(new FieldTrigger {
                Icon = TriggerIcon.Clear, HideTrigger = true
            });
            #endregion Account

            #region Permission
            strPermission = new Store
            {
                ID    = "strPermission",
                Model =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "UID"
                            },
                            new ModelField {
                                Name = "Company"
                            },
                            new ModelField {
                                Name = "Username"
                            },
                            new ModelField {
                                Name = "Page"
                            },
                            new ModelField {
                                Name = "Action"
                            },
                            new ModelField {
                                Name = "Allow"
                            }
                        }
                    }
                }
            };
            grdPermission = new GridPanel
            {
                ID          = "grdPermission",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                Title       = "Permissions List",
                Height      = 250,
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column {
                            DataIndex = "UID",      Text = "UID",      Width    = 0
                        },
                        new Column {
                            DataIndex = "Company",  Text = "Company",  MinWidth = 100, Flex = 1
                        },
                        new Column {
                            DataIndex = "Username", Text = "Username", Width    = 100
                        },
                        new Column {
                            DataIndex = "Page",     Text = "Page",     Width    = 120
                        },
                        new Column {
                            DataIndex = "Action",   Text = "Action",   MinWidth = 150, Flex = 1
                        },
                        new Column {
                            DataIndex = "Allow",    Text = "Allow",    Width    = 100
                        },
                    }
                },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel = { new RowSelectionModel {
                                       Mode = SelectionMode.Single
                                   } }
            };
            grdPermission.Store.Add(strPermission);
            #endregion Permission

            #region GLXAccount
            strGLXAccount = new Store
            {
                ID    = "strGLXAccount",
                Model =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "UID"
                            },
                            new ModelField {
                                Name = "Account"
                            },
                            new ModelField {
                                Name = "Company"
                            }
                        }
                    }
                }
            };
            grdGLXAccount = new GridPanel
            {
                ID          = "grdGLXAccount",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                Title       = "Company List",
                Height      = 250,
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column {
                            DataIndex = "UID",     Text = "UID",     Width = 0
                        },
                        new Column {
                            DataIndex = "Company", Text = "Company", Width = 100, Flex = 1
                        },
                    }
                },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel = { new RowSelectionModel {
                                       Mode = SelectionMode.Single
                                   } }
            };
            grdGLXAccount.Store.Add(strGLXAccount);
            #endregion GLXAccount

            #region LocationAndAccount
            strLocationAndAccount = new Store
            {
                ID    = "strLocationAndAccount",
                Model =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "UID"
                            },
                            new ModelField {
                                Name = "Account"
                            },
                            new ModelField {
                                Name = "Location"
                            }
                        }
                    }
                }
            };
            grdLocationAndAccount = new GridPanel
            {
                ID          = "grdLocationAndAccount",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                Title       = "Location List",
                Height      = 220,
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column {
                            DataIndex = "UID",      Text = "UID",      Width = 0
                        },
                        new Column {
                            DataIndex = "Location", Text = "Location", Width = 100, Flex = 1
                        },
                    }
                },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel = { new RowSelectionModel {
                                       Mode = SelectionMode.Single
                                   } }
            };
            grdLocationAndAccount.Store.Add(strLocationAndAccount);
            #endregion

            #region Worksheet
            strWorksheet = new Store
            {
                ID    = "strWorksheet",
                Model =
                {
                    new Model              {
                        Fields =
                        {
                            new ModelField {
                                Name = "UID"
                            },
                            new ModelField {
                                Name = "Worksheet Template Name"
                            },
                            new ModelField {
                                Name = "Name"
                            },
                            new ModelField {
                                Name = "Description"
                            },
                            new ModelField {
                                Name = "Template Type"
                            },
                            new ModelField {
                                Name = "Recurring"
                            },
                            new ModelField {
                                Name = "Company"
                            },
                            new ModelField {
                                Name = "Account"
                            },
                        }
                    }
                }
            };

            grdWorksheet = new GridPanel
            {
                ID          = "grdWorksheet",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                Title       = "Worksheet List",
                Height      = 220,
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column {
                            DataIndex = "UID",         Text = "UID",         Width = 0
                        },
                        new Column {
                            DataIndex = "Company",     Text = "Company",     Width = 150
                        },
                        new Column {
                            DataIndex = "Name",        Text = "Name",        Width = 100
                        },
                        new Column {
                            DataIndex = "Description", Text = "Description", Width = 120, Flex = 1
                        },
                        new Column {
                            DataIndex = "Account",     Text = "Account",     Width = 100
                        },
                    }
                },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel = { new RowSelectionModel {
                                       Mode = SelectionMode.Single
                                   } }
            };
            grdWorksheet.Store.Add(strWorksheet);
            #endregion

            #region FormPanel
            frmHeader = new FormPanel
            {
                Collapsed   = false,
                Collapsible = true,
                Region      = Region.North,
                Layout      = "HBox",
                Items       =
                {
                    new FormPanel {
                        Layout             = "Anchor",
                        Flex               = 1,
                        BodyPaddingSummary = "10 10 10 10",
                        Border             = false,
                        Items              = { cboUsername }
                    },
                    new FormPanel {
                        Layout             = "Anchor",
                        Flex               = 1,
                        BodyPaddingSummary = "10 10 10 10",
                        Border             = false
                    }
                },
                TopBar =
                {
                    new Toolbar {
                        Items =
                        {
                            btnAddUser,
                            btnDelete
                        }
                    }
                }
            };

            frmGrid = new FormPanel
            {
                Layout             = "HBoxLayout",
                Region             = Region.Center,
                Header             = true,
                BodyPaddingSummary = "5,5,5,5",
                Items =
                {
                    new Panel         {
                        BodyPadding  = 5,
                        Layout       = "VBoxLayout",
                        Flex         = 2,
                        Region       = Region.Center,
                        LayoutConfig ={ new Ext.Net.VBoxLayoutConfig          {
                                            Align = VBoxAlign.Stretch
                                        } },
                        Items =
                        {
                            grdPermission, grdWorksheet
                        }
                    },
                    new Panel         {
                        BodyPaddingSummary = "5,5,5,5",
                        Layout             = "Fit",
                        Flex   = 1,
                        Region = Region.East,
                        Items  =
                        {
                            new Panel {
                                Items ={ grdGLXAccount, grdLocationAndAccount }
                            }
                        }
                    }
                }
            };
            #endregion FormPanel

            this.ID     = "pageMain";
            this.Layout = "BorderLayout";
            this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> {
                frmGrid, frmHeader
            });
        }
Ejemplo n.º 12
0
 public void InitRowExpanderColumn(GridPanel grid)
 {
     grid.ColumnModel.Columns.Insert(this.ColumnPosition, new ReferenceColumn(this.ClientID));
 }
Ejemplo n.º 13
0
 public abstract void ModifyGrid(Button button, GridPanel gridPanel);
Ejemplo n.º 14
0
 public abstract Button GetToolbarButton(ContentItem contentItem, GridPanel gridPanel);
Ejemplo n.º 15
0
 private void InitComponents()
 {
     this.btnRefresh = new Ext.Net.Button {
         Icon = Icon.ArrowRefresh, Text = "Tải lại", ToolTip = "Tải lại"
     };
     this.btnSelect = new Ext.Net.Button {
         Icon = Icon.Find, Text = "Chọn", ToolTip = "Chọn và đóng"
     };
     this.storeMain = new Ext.Net.Store
     {
         ID       = "storeMain",
         PageSize = 20,
         AutoLoad = true,
         Model    =
         {
             new Model              {
                 IDProperty = "No",
                 Fields     =
                 {
                     new ModelField {
                         Name = "No"
                     },
                     new ModelField {
                         Name = "Description"
                     },
                     new ModelField {
                         Name = "Base_Unit_of_Measure"
                     }
                 }
             }
         }
     };
     this.grdMain = new Ext.Net.GridPanel
     {
         ID          = "grdMain",
         ColumnModel =
         {
             Columns           =
             {
                 new Column {
                     DataIndex = "No",                   Text = "No",                   Width = 100
                 },
                 new Column {
                     DataIndex = "Description",          Text = "Description",          Width = 100
                 },
                 new Column {
                     DataIndex = "Base_Unit_of_Measure", Text = "Base Unit of Measure", Width = 100
                 }
             }
         },
         Plugins        = { new FilterHeader {
                            } },
         BottomBar      = { new PagingToolbar {
                            } },
         SelectionModel = { new RowSelectionModel {
                                Mode = SelectionMode.Single
                            } }
     };
     this.grdMain.Store.Add(this.storeMain);
     this.pnlMain = new Ext.Net.Panel
     {
         Region = Region.Center,
         Border = false,
         TopBar =
         {
             new Toolbar
             {
                 Items ={ this.btnRefresh,             new ToolbarSeparator(), this.btnSelect }
             }
         },
         ContentControls = { this.grdMain }
     };
     this.viewPort = new Viewport {
         Layout = "Border", Items = { this.pnlMain }
     };
     this.Form.Controls.Add(this.viewPort);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 初始化查询主界面项
        /// </summary>
        /// <param name="grid"></param>
        public void IniSelectMainGrid(Ext.Net.GridPanel grid)
        {
            #region 分页每页数量
            var pagesize = uiHelper.Select.MainGrid.PageSize;
            if (pagesize <= 0)
            {
                pagesize = 15;
            }
            grid.GetStore().PageSize = pagesize;
            #endregion

            string prefix = UiControlNamePrefix.SelectMainGrid;
            Model  model  = grid.GetStore().ModelInstance;
            #region 网格条数信息
            int havecount = grid.ColumnModel.Columns.Count;
            RowNumbererColumn numbercol = new RowNumbererColumn();
            numbercol.Width = 40;
            grid.ColumnModel.Columns.Insert(grid.ColumnModel.Columns.Count - havecount, numbercol);
            #endregion

            #region 添加特殊字段
            if (uiHelper.UiData.Crud.Primarykey != null &&
                !string.IsNullOrWhiteSpace(uiHelper.UiData.Crud.Primarykey.FieldName))
            {
                IniAddGridColumn(prefix, uiHelper.UiData.Crud.Primarykey.FieldName, havecount, grid);
            }
            IniAddGridColumn(prefix, uiHelper.UiData.Crud.DeleteFlag, havecount, grid);
            #endregion

            #region 添加设置字段
            foreach (GridColumn column in uiHelper.Select.MainGrid.Columns)
            {
                ModelField mField = new ModelField();
                mField.Name = column.ColumnName;
                if (column.ColumnType == GridColumnType.Date)
                {
                    mField.Type = ModelFieldType.Date;
                }
                model.Fields.Add(mField);
                if (column.IsShow)
                {
                    CellCommandColumn cell = IniGridColumn(prefix, column);
                    grid.ColumnModel.Columns.Insert(grid.ColumnModel.Columns.Count - havecount, cell);
                }
            }
            #endregion

            #region 更新显示按钮
            if (uiHelper.Update.Panel.ParamFields.Count > 0)
            {
                return;
            }
            int commandcount = 0;
            if (uiHelper.Select.MainDetail.ParamFields.Count > 0)
            {
                commandcount++;
            }
            if (uiHelper.Select.DetailGrid.Columns.Count > 0)
            {
                commandcount++;
            }
            if (commandcount == 0)
            {
                return;
            }
            CommandColumn commandColumn = new CommandColumn();
            commandColumn.ID    = "commandColumnShowDetail";
            commandColumn.Width = commandcount * 86;
            commandColumn.Text  = "查看";
            commandColumn.Align = Alignment.Center;
            int _command = commandColumn.Commands.Count;
            if (uiHelper.Select.MainDetail.ParamFields.Count > 0)
            {
                GridCommand command = new GridCommand();
                command.Icon        = Icon.TableColumn;
                command.Text        = "详细信息";
                command.CommandName = "ShowFieldsInfo";
                commandColumn.Commands.Add(command);
                commandColumn.Listeners.Command.Fn = "showdetailcommandcolumn_click";
            }
            if (commandColumn.Commands.Count > _command)
            {
                commandColumn.Commands.Add(new CommandSeparator());
                _command = commandColumn.Commands.Count;
            }
            if (uiHelper.Select.DetailGrid.Columns.Count > 0)
            {
                GridCommand command = new GridCommand();
                command.Icon        = Icon.TableColumn;
                command.Text        = "明细信息";
                command.CommandName = "ShowDetail";
                commandColumn.Commands.Add(command);
                commandColumn.Listeners.Command.Fn = "showdetailcommandcolumn_click";
            }
            grid.ColumnModel.Columns.Add(commandColumn);
            #endregion
        }
Ejemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="g"></param>
 /// <param name="columnCollection"></param>
 public static void BindColumns(this GridPanel g, IList <ColumnBase> columnCollection)
 {
     g.ColumnModel.Columns.AddRange(columnCollection);
 }
Ejemplo n.º 18
0
        public void BuildLevel(int level, string recId, string gridId,string dtype)
        {
            var storeId = "L".ConcatWith(level, "_", recId, "_Store");
            var newGridId = "L".ConcatWith(level, "_", recId, "_Grid");

            // build store
            var store = new Store { ID = storeId };
            var reader = new JsonReader { IDProperty = "ID" };
            reader.Fields.Add("ID", "Type", "Heji", "Biaodanhao", "Tijiao");
            reader.Fields.Add(new RecordField
            {
                Name = "Level",
                Convert = { Handler = "return ".ConcatWith(level, ";") }
            });
            store.Reader.Add(reader);
            //store.CustomConfig.Add(new ConfigItem("level", level.ToString(), ParameterMode.Raw));

            // bind store
            DataTable dt = new DataTable();
            dt.Columns.Add("ID");
            dt.Columns.Add("Type");
            dt.Columns.Add("Heji");
            dt.Columns.Add("Biaodanhao");
            dt.Columns.Add("Tijiao");
            if (level == 1)
            {
                DataRow dr = dt.NewRow();
                dr["ID"] = "0";
                dr["Type"] = "差旅费";
                dr["Heji"] = "100";
                dr["Biaodanhao"] = "BJS110" + level.ToString();
                dr["Tijiao"] = "2012-12-11";
                dt.Rows.Add(dr);
                dr = dt.NewRow();
                dr["ID"] = "1";
                dr["Type"] = "通用费用";
                dr["Heji"] = "1100";
                dr["Biaodanhao"] = "BJS111" + level.ToString();
                dr["Tijiao"] = "2012-12-21";
                dt.Rows.Add(dr);
                dr = dt.NewRow();
                dr["ID"] = "2";
                dr["Type"] = "差旅费";
                dr["Heji"] = "100";
                dr["Biaodanhao"] = "BJS112" + level.ToString();
                dr["Tijiao"] = "2012-12-31";
                dt.Rows.Add(dr);
                dr = dt.NewRow();
                dr["ID"] = "3";
                dr["Type"] = "通用费用";
                dr["Heji"] = "100";
                dr["Biaodanhao"] = "BJS113" + level.ToString();
                dr["Tijiao"] = "2012-11-11";
                dt.Rows.Add(dr);
            }
            else if(level == 2)
            {
                
                if (dtype == "差旅费")
                {


                    Random ran = new Random();
                    DataRow dr = dt.NewRow();
                    dr["ID"] = recId + "20";
                    dr["Type"] = "票价合计";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "21";
                    dr["Type"] = "酒店";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "22";
                    dr["Type"] = "交通费";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "23";
                    dr["Type"] = "膳食费";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "24";
                    dr["Type"] = "机场费";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "25";
                    dr["Type"] = "其他";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "26";
                    dr["Type"] = "每日津贴";
                    dr["Heji"] = "120";
                    dr["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                }
                else
                {
                    DataRow dr = dt.NewRow();
                    dr = dt.NewRow();
                    dr["ID"] = recId + "20";
                    dr["Type"] = "交际费";
                    dr["Heji"] = "100";
                    dr["Biaodanhao"] = "BJS110" + level.ToString();
                    dr["Tijiao"] = "2012-12-11";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "21";
                    dr["Type"] = "交通费";
                    dr["Heji"] = "1100";
                    dr["Biaodanhao"] = "BJS111" + level.ToString();
                    dr["Tijiao"] = "2012-12-21";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "22";
                    dr["Type"] = "通讯费";
                    dr["Heji"] = "100";
                    dr["Biaodanhao"] = "BJS112" + level.ToString();
                    dr["Tijiao"] = "2012-12-31";
                    dt.Rows.Add(dr);
                    dr = dt.NewRow();
                    dr["ID"] = recId + "23";
                    dr["Type"] = "其他费用";
                    dr["Heji"] = "100";
                    dr["Biaodanhao"] = "BJS113" + level.ToString();
                    dr["Tijiao"] = "2012-11-11";
                    dt.Rows.Add(dr);
                }
            }
            else if (level == 3 && dtype != "差旅费")
            {
                for (int i = 0; i < 4; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["ID"] = recId + "3" + i.ToString();
                    dr["Type"] = "其他费用";
                    dr["Heji"] = (100 + i).ToString();
                    dr["Biaodanhao"] = "费用描述";
                    dr["Tijiao"] = "2012-11-11";
                    dt.Rows.Add(dr);
                }
            }

            //var data = new List<object>();

            //for (int i = 1; i <= 9; i++)
            //{
            //    data.Add(new { ID = recId.ConcatWith("_R", i), Biaodanhao = "Level".ConcatWith(level, ": Row " + i), Type = "Level".ConcatWith(level, ": Row " + i), Heji = "Level".ConcatWith(level, ": Row " + i), Tijiao = "Level".ConcatWith(level, ": Row " + i) });
            //}

            //build grid
            var grid = new GridPanel
            {
                ID = newGridId,
                Store = { 
                                    store
                                 },
                AutoHeight = true,
                AutoScroll = true,
                EnableColumnMove = level == 1,
            };

            //build columns
            grid.ColumnModel.Columns.Add(new RowNumbererColumn { Width = 25 });
            if (level==1)
            {
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Biaodanhao", Header = "表单号" });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Type", Header = "单据类型" });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "合计" });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Tijiao", Header = "提交时间" });
            }
            else if(level == 2)
            {
                if (dtype == "差旅费")
                {
                    grid.ColumnModel.Columns.Add(new Column { DataIndex = "Type", Header = "费用类型", Resizable = false });
                    grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "合计", Resizable = false });
                    grid.ColumnModel.Columns.Add(new Column { DataIndex = "Biaodanhao", Header = "公司预支", Resizable = false });
                }
                else
                {
                    grid.ColumnModel.Columns.Add(new Column { DataIndex = "Type", Header = "单据类型", Resizable = false });
                    grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "合计", Resizable = false });
                }
            }
            else if (level == 3)
            {
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "金额", Resizable = false });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "费用描述", Resizable = false });
            }
            
            grid.ColumnModel.ID = newGridId + "_CM";

            // build view
            var view = new Ext.Net.GridView
            {
                ID = newGridId + "_View",
                ForceFit = true
            };
            grid.View.Add(view);

            // build selection model
            var sm = new RowSelectionModel { ID = newGridId + "_SM" };
            //if (level != 3 && dtype != "差旅费")
            //{
            //    sm.Listeners.BeforeRowSelect.Handler = "return false;";//合计类不允许选择
            //}
            grid.SelectionModel.Add(sm);
            RowExpander rem = new RowExpander();
            // add expander for all levels except last (last level is 5)
            if (level < 3 && dtype != "差旅费")
            {
                view.Listeners.BeforeRefresh.Fn = "clean";
                var re = new RowExpander
                {
                    ID = newGridId + "_RE",
                    EnableCaching = true,
                    Template = { ID = newGridId + "_TPL", Html = "<div id=\"row_{ID}\" style=\"background-color:white;\"></div>" }
                };
                re.Listeners.BeforeExpand.Fn = "loadLevel";
                rem = re;
                grid.Plugins.Add(re);
            }

            store.DataSource = dt;
            store.DataBind();

            if (level == 1)
            {
                grid.Title = "可按住Ctrl以多选.";
                grid.Height = 400;
                grid.AutoHeight = false;
                grid.Border = false;
                //this.Form.Controls.Add(grid);
                Panel5.Html = "";
                Panel5.Items.Add(grid);
                //grid.Plugins.Add(new PanelResizer());
            }
            else
            {
                var renderEl = "row_" + recId;
                X.Get(renderEl).SwallowEvent(new string[] { "click", "mousedown", "mouseup", "dblclick" }, true);

                this.RemoveFromCache(newGridId, gridId);
                if (level < 3)
                {
                    grid.Listeners.ViewReady.Fn = "expangrid";
                    grid.Listeners.ViewReady.Single = true;
                }
                grid.Render(renderEl, RenderMode.RenderTo);
                this.AddToCache(newGridId, gridId);
            }
            //string gl = newGridId;
            ////记录选择行的空间名
            //if (level == 3 || (level == 2 && dtype == "差旅费"))
            //{
            //    X.AddScript("var st=Hidden1.getValue();Hidden1.setValue(st+='" + gl + ",');");
            //    //X.AddScript("var st=TextField1.getValue();TextField1.setValue(st+='" + gl + ",');");
            //}
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 初始化查询 查询汇总
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="model"></param>
 public void IniSelectSummaryGrid(Ext.Net.GridPanel grid)
 {
 }
Ejemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 public GridPanel.Builder GridPanel(GridPanel component)
 {
     return(new GridPanel.Builder(component));
 }
Ejemplo n.º 21
0
        protected void loadgrid2(object sender, DirectEventArgs e)
        {
            var store = new Store { ID = "Store1" };
            var reader = new JsonReader { IDProperty = "ID" };
            reader.Fields.Add("ID", "Type", "Heji", "Biaodanhao", "Tijiao");
            reader.Fields.Add(new RecordField
            {
                Name = "Level",
                Convert = { Handler = "return ".ConcatWith(1, ";") }
            });
            store.Reader.Add(reader);

            DataTable dt = new DataTable();
            dt.Columns.Add("ID");
            dt.Columns.Add("Type");
            dt.Columns.Add("Heji");
            dt.Columns.Add("Biaodanhao");
            dt.Columns.Add("Tijiao");
            DataRow dr = dt.NewRow();
            dr["ID"] = "10";
            dr["Type"] = "差旅费";
            dr["Heji"] = "100";
            dr["Biaodanhao"] = "BJS1101";
            dr["Tijiao"] = "2012-12-11";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["ID"] = "11";
            dr["Type"] = "通用费用";
            dr["Heji"] = "1100";
            dr["Biaodanhao"] = "BJS1112";
            dr["Tijiao"] = "2012-12-21";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["ID"] = "12";
            dr["Type"] = "差旅费";
            dr["Heji"] = "100";
            dr["Biaodanhao"] = "BJS1123";
            dr["Tijiao"] = "2012-12-31";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["ID"] = "13";
            dr["Type"] = "通用费用";
            dr["Heji"] = "100";
            dr["Biaodanhao"] = "BJS1134";
            dr["Tijiao"] = "2012-11-11";
            dt.Rows.Add(dr);
            
            var grid = new GridPanel
            {
                ID = "Grid1",
                Store = { 
                                    store
                                 },
                AutoScroll = true,
                Border = false,
                Title = "可按住Ctrl以多选,然后点击右侧&quot;+&quot;按钮向右侧添加数据.",
                Height = 530
            };
            //build columns
            grid.ColumnModel.Columns.Add(new RowNumbererColumn { Width = 25 });
            grid.ColumnModel.Columns.Add(new Column { DataIndex = "Biaodanhao", Header = "表单号" });
            grid.ColumnModel.Columns.Add(new Column { DataIndex = "Type", Header = "单据类型" });
            grid.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "合计" });
            grid.ColumnModel.Columns.Add(new Column { DataIndex = "Tijiao", Header = "提交时间" });
            grid.ColumnModel.ID = "Grid1_CM";
            var view = new Ext.Net.GridView
            {
                ID = "Grid1_View",
                ForceFit = true
            };
            grid.View.Add(view);
            var sm = new RowSelectionModel { ID = "Grid1_SM" };
            //sm.Listeners.BeforeRowSelect.Handler = "return false;";//合计类不允许选择
            grid.SelectionModel.Add(sm);

            // add expander for all levels except last (last level is 5)
            view.Listeners.BeforeRefresh.Fn = "clean";
            var re = new RowExpander
            {
                ID = "Grid1_RE",
                EnableCaching = true,
                Template = { ID = "Grid1_TPL", Html = "<div id=\"row_{ID}\" style=\"background-color:white;\"></div>" }
            };
            re.Listeners.BeforeExpand.Fn = "loadLevel";
            grid.Plugins.Add(re);
            Panel5.Items.Add(grid);
            store.DataSource = dt;
            store.DataBind();
            grid.Listeners.ViewReady.Fn = "expangrid";
            grid.Listeners.ViewReady.Single = true;
            grid.Render();
            //X.AddScript("expandallgrid();");
            //re.ExpandAll();
            //BuildLevel(int level, string recId, string gridId,string dtype)
            //
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    if (dt.Rows[i]["Type"].ToString() == "差旅费")
            //    {
            //        var newgridid = "L2_" + dt.Rows[i]["ID"].ToString() + "_Grid";
            //        var store2 = new Store { ID = "L2_" + dt.Rows[i]["ID"].ToString() + "_Store" };
            //        var reader2 = new JsonReader { IDProperty = "ID" };
            //        reader.Fields.Add("ID", "Type", "Heji", "Biaodanhao", "Tijiao");
            //        reader.Fields.Add(new RecordField
            //        {
            //            Name = "Level",
            //            Convert = { Handler = "return ".ConcatWith(2, ";") }
            //        });
            //        store2.Reader.Add(reader2);

            //        DataTable dt2 = new DataTable();
            //        dt2.Columns.Add("ID");
            //        dt2.Columns.Add("Type");
            //        dt2.Columns.Add("Heji");
            //        dt2.Columns.Add("Biaodanhao");
            //        dt2.Columns.Add("Tijiao");
            //        Random ran = new Random();
            //        DataRow dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "0";
            //        dr2["Type"] = "票价合计";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "1";
            //        dr2["Type"] = "酒店";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "2";
            //        dr2["Type"] = "交通费";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "3";
            //        dr2["Type"] = "膳食费";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "4";
            //        dr2["Type"] = "机场费";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "5";
            //        dr2["Type"] = "其他";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);
            //        dr2 = dt2.NewRow();
            //        dr2["ID"] = dt.Rows[i]["ID"].ToString() + "6";
            //        dr2["Type"] = "每日津贴";
            //        dr2["Heji"] = "120";
            //        dr2["Biaodanhao"] = (120 * Math.Round((decimal)ran.Next(1, 10), 1)).ToString();
            //        dr2["Tijiao"] = "2012-12-11";
            //        dt2.Rows.Add(dr2);

            //        var grid2 = new GridPanel
            //        {
            //            ID = newgridid,
            //            Store = { 
            //                        store2
            //                     },
            //            AutoHeight = true,
            //            AutoScroll = true,
            //            EnableColumnMove = false,
            //        };
            //        //build columns
            //        grid2.ColumnModel.Columns.Add(new RowNumbererColumn { Width = 25 });
            //        grid2.ColumnModel.Columns.Add(new Column { DataIndex = "Type", Header = "费用类型", Resizable = false });
            //        grid2.ColumnModel.Columns.Add(new Column { DataIndex = "Heji", Header = "合计", Resizable = false });
            //        grid2.ColumnModel.Columns.Add(new Column { DataIndex = "Biaodanhao", Header = "公司预支", Resizable = false });
            //        grid2.ColumnModel.ID = newgridid + "_CM";
            //        var view2 = new Ext.Net.GridView
            //        {
            //            ID = newgridid+"_View",
            //            ForceFit = true
            //        };
            //        grid2.View.Add(view2);
            //        var sm2 = new RowSelectionModel { ID = newgridid+"_SM" };
            //        sm2.Listeners.BeforeRowSelect.Handler = "return false;";//合计类不允许选择
            //        grid2.SelectionModel.Add(sm2);

            //        // add expander for all levels except last (last level is 5)
            //        view2.Listeners.BeforeRefresh.Fn = "clean";
            //        var re2 = new RowExpander
            //        {
            //            ID = newgridid+"_RE",
            //            EnableCaching = true,
            //            Template = { ID = newgridid+"_TPL", Html = "<div id=\"row_{ID}\" style=\"background-color:white;\"></div>" }
            //        };
            //        //re2.Listeners.BeforeExpand.Fn = "loadLevel";
            //        grid2.Plugins.Add(re2);

            //        var renderEl2 = "row_" + dt.Rows[i]["ID"].ToString();
            //        X.Get(renderEl2).SwallowEvent(new string[] { "click", "mousedown", "mouseup", "dblclick" }, true);
            //        this.RemoveFromCache(newgridid, "Grid1");

            //        store2.DataSource = dt2;
            //        store2.DataBind();

            //        grid.Render(renderEl2, RenderMode.RenderTo);
            //        this.AddToCache(newgridid, "Grid1");
            //    }
            //}
            //if (1 == 1)
            //{
            //    grid.Title = "可按住Ctrl以多选.";
            //    grid.Height = 400;
            //    grid.AutoHeight = false;
            //    grid.Border = false;
            //    //this.Form.Controls.Add(grid);
            //    Panel5.Html = "";
            //    Panel5.Items.Add(grid);
            //    //grid.Plugins.Add(new PanelResizer());
            //}
            //else
            //{
                //var renderEl = "row_" + recId;
                //X.Get(renderEl).SwallowEvent(new string[] { "click", "mousedown", "mouseup", "dblclick" }, true);

                //this.RemoveFromCache(newGridId, gridId);
                //grid.Render(renderEl, RenderMode.RenderTo);
                //this.AddToCache(newGridId, gridId);
            //}
            //
            
            
        }
Ejemplo n.º 22
0
 public override void ModifyGrid(Button button, GridPanel gridPanel)
 {
     CheckboxSelectionModel selectionModel = (CheckboxSelectionModel) gridPanel.SelectionModel.Primary;
     selectionModel.Listeners.RowSelect.Handler = string.Format("{0}.enable();", button.ClientID);
     selectionModel.Listeners.RowDeselect.Handler = string.Format("if (!{0}.hasSelection()) {{{1}.disable();}}", gridPanel.ClientID, button.ClientID);
 }
Ejemplo n.º 23
0
        private void InitComponent()
        {
            btnSearch = new Button {
                Icon = Icon.Find, Text = "Find", ToolTip = "Find"
            };
            btnAddItem = new Button {
                Icon = Icon.ImageAdd, Text = "Thêm", ToolTip = "Thêm"
            };
            btnEditItem = new Button {
                Icon = Icon.ImageEdit, Text = "Sửa", ToolTip = "Sửa"
            };
            btnPrint = new Button {
                Icon = Icon.Printer, Text = "Print", ToolTip = "Print"
            };

            int      daysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
            DateTime FromDate    = DateTime.Now.AddDays(-1 * daysInMonth);

            dfFromDate = new DateField
            {
                LabelWidth      = 100,
                FieldLabel      = "Document Date",
                Anchor          = "100%",
                Format          = "dd/MM/yyyy",
                SubmitFormat    = "dd/MM/yyyy",
                SelectOnFocus   = true,
                SelectedDate    = FromDate,
                ID              = "dfFromDate",
                EnableKeyEvents = true,
                Vtype           = "daterange",
                CustomConfig    =
                {
                    new ConfigItem {
                        Name = "endDateField", Value = "dfToDate", Mode = ParameterMode.Value
                    }
                }
            };
            dfToDate = new DateField
            {
                LabelWidth      = 20,
                Anchor          = "100%",
                Format          = "dd/MM/yyyy",
                SubmitFormat    = "dd/MM/yyyy",
                SelectOnFocus   = true,
                SelectedDate    = DateTime.Now,
                ID              = "dfToDate",
                Vtype           = "daterange",
                EnableKeyEvents = true,
                CustomConfig    =
                {
                    new ConfigItem {
                        Name = "startDateField", Value = "dfFromDate", Mode = ParameterMode.Value
                    }
                }
            };

            strItems = new Store
            {
                ID    = "strItems",
                Model =
                {
                    new Model              {
                        IDProperty = "Key",
                        Fields     =
                        {
                            new ModelField {
                                Name = "Key"
                            },
                            new ModelField {
                                Name = "No"
                            },
                            new ModelField {
                                Name = "Buy_from_Vendor_No"
                            },
                            new ModelField {
                                Name = "Buy_from_Vendor_Name"
                            },
                            new ModelField {
                                Name = "Status"
                            },
                            new ModelField {
                                Name = "Document_Date", Type = ModelFieldType.Date
                            },
                            new ModelField {
                                Name = "Posting_Date", Type = ModelFieldType.Date
                            },
                            new ModelField {
                                Name = "Order_Date", Type = ModelFieldType.Date
                            },
                            new ModelField {
                                Name = "Vendor_Authorization_No"
                            },
                            new ModelField {
                                Name = "Vista_Order_No"
                            },
                            new ModelField {
                                Name = "Location_Code"
                            },
                            new ModelField {
                                Name = "Assigned_User_ID"
                            },
                            new ModelField {
                                Name = "Job_Queue_Status"
                            },
                            new ModelField {
                                Name = "Amount", Type = ModelFieldType.Float
                            },
                            new ModelField {
                                Name = "Amount_Including_VAT", Type = ModelFieldType.Float
                            },
                        }
                    }
                }
            };

            grdItems = new GridPanel
            {
                ID          = "grdItems",
                BodyCls     = "line-body-border",
                CtCls       = "line-border",
                ColumnModel =
                {
                    Columns           =
                    {
                        new Column     {
                            DataIndex = "Key",                  Text = "Key",                  Width = 0
                        },
                        new Column     {
                            DataIndex = "No",                   Text = "No",                   Width = 120,
                        },
                        new Column     {
                            DataIndex = "Buy_from_Vendor_No",   Text = "Vendor No.",           Width = 120
                        },
                        new Column     {
                            DataIndex = "Buy_from_Vendor_Name", Text = "Buy from Vendor Name", Width = 220,Flex    = 1
                        },
                        new Column     {
                            DataIndex = "Location_Code",        Text = "Location_Code",        Width = 120
                        },
                        new Column     {
                            DataIndex = "Status",               Text = "Status",               Width = 120
                        },
                        new DateColumn {
                            DataIndex = "Document_Date",        Text = "Document Date",        Width = 120,Format  = "dd/MM/yyyy"
                        },
                        new DateColumn {
                            DataIndex = "Posting_Date",         Text = "Posting Date",         Width = 120,Format  = "dd/MM/yyyy"
                        },
                        //new DateColumn{ DataIndex = "Order_Date", Text = "Order Date", Width = 120, Format = "dd/MM/yyyy" },
                    }
                },
                TopBar =
                {
                    new Toolbar {
                        Items =
                        {
                            dfFromDate, dfToDate, btnSearch,//btnAddItem, btnEditItem
                            btnPrint
                        }
                    }
                },
                Plugins   = { new FilterHeader {
                              } },
                BottomBar = { new PagingToolbar {
                                  HideRefresh = true
                              } },
                SelectionModel =
                {
                    new RowSelectionModel {
                        Mode = SelectionMode.Single
                    }
                }
            };

            grdItems.Store.Add(strItems);

            pnlCenter = new Panel
            {
                Layout = "Fit",
                Region = Region.Center,
                Items  = { grdItems }
            };
            pnlLeft = new Panel {
                Width       = 250,
                Title       = "Menu",
                Collapsible = true,
                Collapsed   = true,
                Region      = Region.West,
                Layout      = "VBoxLayout",
                Items       =
                {
                    new Ext.Net.HyperLink {
                        Width       = 250,
                        Icon        = Icon.Accept,
                        Target      = "_blank",
                        NavigateUrl = "../../Login.aspx",
                        Text        = "Relogin"
                    },

                    new Ext.Net.HyperLink {
                        Width       = 250,
                        Icon        = Icon.PackageGo,
                        Target      = "_blank",
                        NavigateUrl = "../ReqWorksheet",
                        Text        = "Req. Worksheets"
                    },

                    //new Ext.Net.HyperLink {
                    //    Width = 250,
                    //    Icon = Icon.Page,
                    //    Target = "_blank",
                    //    NavigateUrl = "../ReqWorksheet2",
                    //    Text = "Req. Worksheets 2"
                    //}
                }
            };
            this.ID     = "pageMain";
            this.Layout = "BorderLayout";
            this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> {
                pnlLeft,
                pnlCenter
            });
        }
Ejemplo n.º 24
0
        public void BuildLevel(int level, string recId, string gridId)
        {
            var storeId = "L".ConcatWith(level, "_", recId, "_Store");
            var newGridId = "L".ConcatWith(level, "_", recId, "_Grid");

            // build store
            var store = new Store { ID = storeId };
            var reader = new JsonReader { IDProperty = "ID" };
            reader.Fields.Add("ID", "Name");
            reader.Fields.Add(new RecordField
            {
                Name = "Level",
                Convert = { Handler = "return ".ConcatWith(level, ";") }
            });
            store.Reader.Add(reader);
            store.CustomConfig.Add(new ConfigItem("level", level.ToString(), ParameterMode.Raw));

            // bind store
            var data = new List<object>();

            for (int i = 1; i <= 9; i++)
            {
                data.Add(new { ID = recId.ConcatWith("_R", i), Name = "Level".ConcatWith(level, ": Row " + i) });
            }

            //build grid
            var grid = new GridPanel
            {
                ID = newGridId,
                Store = { 
                                    store
                                 },
                AutoHeight = true,
                EnableColumnMove = level == 1
            };

            //build columns
            grid.ColumnModel.Columns.Add(new RowNumbererColumn { Width = 25 });
            if (level==1)
            {
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Name" });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Class" });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Class1" });
            }
            else
            {
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Name", Resizable = false });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Class", Resizable = false });
                grid.ColumnModel.Columns.Add(new Column { DataIndex = "Name", Header = "Class1", Resizable = false });
            }
            
            grid.ColumnModel.ID = newGridId + "_CM";

            // build view
            var view = new Ext.Net.GridView
            {
                ID = newGridId + "_View",
                ForceFit = true
            };
            grid.View.Add(view);

            // build selection model
            var sm = new RowSelectionModel { ID = newGridId + "_SM" };
            if (level != 3)
            {
                sm.Listeners.BeforeRowSelect.Handler = "return false;";//合计类不允许选择
            }
            grid.SelectionModel.Add(sm);

            // add expander for all levels except last (last level is 5)
            if (level < 3)
            {
                view.Listeners.BeforeRefresh.Fn = "clean";
                var re = new RowExpander
                {
                    ID = newGridId + "_RE",
                    EnableCaching = true,
                    Template = { ID = newGridId + "_TPL", Html = "<div id=\"row_{ID}\" style=\"background-color:white;\"></div>" }
                };

                re.Listeners.BeforeExpand.Fn = "loadLevel";

                grid.Plugins.Add(re);
            }

            store.DataSource = data;
            store.DataBind();

            if (level == 1)
            {
                grid.Title = "MultiLevel grid";
                grid.Width = 600;
                grid.Height = 600;
                grid.AutoHeight = false;
                //this.Form.Controls.Add(grid);
                Container1.Items.Add(grid);
                grid.Plugins.Add(new PanelResizer());
            }
            else
            {
                var renderEl = "row_" + recId;
                X.Get(renderEl).SwallowEvent(new string[] { "click", "mousedown", "mouseup", "dblclick" }, true);

                this.RemoveFromCache(newGridId, gridId);
                grid.Render(renderEl, RenderMode.RenderTo);
                this.AddToCache(newGridId, gridId);
            }
        }