zoukankan      html  css  js  c++  java
  • XAF 如何实现ListView单元格批量更改?

    XAF 如何实现ListView单元格批量更改?

       public partial class GridViewCellsValueUpdateViewController : ViewController
        {
            
    public GridViewCellsValueUpdateViewController()
            {
                InitializeComponent();
                RegisterActions(components);
            }
            
    protected override void OnActivated()
            {
                
    base.OnActivated();
                
    //this.paUpdateCellsValue.Enabled.SetItemValue("ObjectType", SecuritySystem.IsGranted(new ActionAccessPermission(this.paUpdateCellsValue.Id, DevExpress.ExpressApp.Security.ObjectAccessModifier.Allow)));
             
    }
            
    private GridView gridView = null;
            
    private void GridViewCellsValueUpdateViewController_ViewControlsCreated(object sender, EventArgs e)
            {
                gridView 
    = ((View as ListView).Editor as GridListEditor).GridView;
                gridView.OptionsSelection.MultiSelect 
    = true;
                gridView.OptionsSelection.MultiSelectMode 
    = GridMultiSelectMode.CellSelect;
            }

            
    private void paUpdateCellsValue_Execute(object sender, ParametrizedActionExecuteEventArgs e)
            {
                
    if (e.ParameterCurrentValue == nullreturn;
                gridView.ClearSorting();

                DevExpress.XtraGrid.Views.Base.GridCell[] selectedCells 
    = gridView.GetSelectedCells();
                
    object obj = null;
                
    foreach (var item in selectedCells)
                {
                    
    string typeName = item.Column.ColumnType.Name;
                    
    if (typeName == "String" || typeName == "Double" || typeName == "DateTime" || typeName == "Int32")
                    {
                        
    if (item.Column.FieldName == "Create_Date" || item.Column.FieldName == "Write_Date")
                        { obj 
    = null; }
                        
    else
                        {obj 
    = e.ParameterCurrentValue;  }
                    }
                    
    else
                    {
                        obj 
    = ((ObjectSpace)View.ObjectSpace).Session.FindObject(item.Column.ColumnType, new BinaryOperator

                            (
    "Name", e.ParameterCurrentValue, BinaryOperatorType.Equal));
                    }
                    
    if (obj != null)
                    { gridView.SetRowCellValue(item.RowHandle, item.Column, obj); }
                    obj 
    = null;
                }
            }
        }
  • 相关阅读:
    .ssh/config 常用配置
    openresty(nginx) 配置 http与https使用同一个端口,禁止 IP 直接访问
    uni-app 入门小白纯徒手编写组件 hello-popup
    CSS 是啥?前端小白入门级理解
    爱思助手备份 iPhone 时没有设置密码,恢复备份时需要密码的问题
    introduction-to-64-bit-assembly
    flv to mp4
    Hopper Disassembler系列之Sublime Text 3 爆破
    Hopper 学习
    微信小游戏 Three.js UI 2D text 简单方案
  • 原文地址:https://www.cnblogs.com/Tonyyang/p/1985087.html
Copyright © 2011-2022 走看看