Exemplo n.º 1
0
 protected override void OnPreInit(EventArgs e)
 {
     base.OnPreInit(e);
     _viewPort = new Viewport();
     _grid = new GridPanelEx();
     _grid.ItemType = typeof(RoleManagerModel);
     _grid.ReadData += _grid_ReadData;
     _grid.Delete += _grid_Delete;
     _grid.EnableAdd = EnableAddRole;
     _grid.EnableEdit = EnableEditRole;
     _grid.EnableRemove = EnableRemoveRole;
     _grid.Region = Region.Center;
     _grid.ID = "gridRoles";
     _grid.EditorConfig = new GridPanelEditorConfig();
     var _addWindowConfig = new WindowConfig();
     _addWindowConfig.Height = 400;
     _addWindowConfig.Width = 800;
     _addWindowConfig.Url = AddUrl;
     _addWindowConfig.Title = "添加角色";
     _grid.EditorConfig.AddWindow = _addWindowConfig;
     var _editWindowConfig = new WindowConfig();
     _editWindowConfig.Height = 400;
     _editWindowConfig.Width = 800;
     _editWindowConfig.Url = EditUrl;
     _editWindowConfig.Title = "编辑角色";
     _editWindowConfig.ExtraParams.Add(new Parameter("id", "record.data.Id", ParameterMode.Raw));
     _grid.EditorConfig.EditWindow = _editWindowConfig;
     _viewPort.Add(_grid);
     _viewPort.Layout = "border";
     Controls.Add(_viewPort);
 }
Exemplo n.º 2
0
 private void btnAdd_DirectClick(object sender, DirectEventArgs e)
 {
     if (this.EditorConfig == null)
     {
         throw new SettingsPropertyNotFoundException("EditorConfig未设置");
     }
     if (!this.EnableAdd)
     {
         Ext.Net.X.Msg.Alert("错误", "无法添加记录").Show();
     }
     else if (this.EditorConfig.Mode != EditorMode.Inline)
     {
         WindowConfig addWindow = this.EditorConfig.AddWindow;
         string       str       = this.Page.ResolveClientUrl(addWindow.Url ?? "");
         foreach (Parameter parameter in this.EditorConfig.ExtraParams)
         {
             str = str.Replace("{" + parameter.Name + "}", e.ExtraParams[parameter.Name]);
         }
         this._editWindow.Height     = addWindow.Height;
         this._editWindow.Width      = addWindow.Width;
         this._editWindow.Title      = addWindow.Title;
         _editWindow.Icon            = Ext.Net.Icon.ApplicationAdd;
         this._editWindow.Loader.Url = str;
         foreach (Parameter parameter in this.EditorConfig.AddWindow.ExtraParams)
         {
             this._editWindow.Loader.Url = this._editWindow.Loader.Url.Replace("{" + parameter.Name + "}", e.ExtraParams[parameter.Name]);
         }
         this._editWindow.Show();
         this._editWindow.Loader.LoadContent();
     }
 }