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;
                }
            }
        }
  • 相关阅读:
    C# WinForm 只允许运行一个实例
    C# WinForm 获得文字的像素宽度
    Windows 下使用命令行升级 Npm 和 NodeJS
    每日踩坑 2020-04-15 C# 与 Java 对应 DES 加密算法
    robot自动化测试(二)--- template使用
    robot自动化测试(一)---安装
    linux io优化
    python 远程统计文件
    编程类学习资料整合,更多干货
    两份安卓学习资料,我建议你看完
  • 原文地址:https://www.cnblogs.com/Tonyyang/p/1985087.html
Copyright © 2011-2022 走看看