ag-grid-vue的配置

 public get gridOptions(): GridOptions {
    const that = this;
    return {
      headerHeight: 30,// 表头高度
      rowHeight: 30,// 行高
      columnDefs: [//列定义
        {
          headerName: '规则唯一号',
          field: 'RuleCode',
          width: 90,
        },
        {
          headerName: '医疗单元号',
          field: 'UnitId',
          width: 90,
        },
        {
          headerName: '系统分类',
          field: 'SysType',
          width: 80,
        },
        {
          headerName: '子系统分类',
          field: 'SubsysType',
          width: 90,
        },
        {
          headerName: '序列号中文名称',
          field: 'KeyName',
          width: 120,
        },
        {
          headerName: '前缀',
          field: 'KeyPrechar',
          width: 80,
        },
        {
          headerName: '格式化编号类型',
          field: 'KeyFmtcodeType',
          width: 120,
          cellRenderer: (params) => {
            for (const item of this.fmtcodeTypeArr) {
              if (item.value === params.data.KeyFmtcodeType) {
                return '<span>' + item.label + '</span>';
              }
            }
          },
        },
        {
          headerName: '顺序号长度',
          field: 'KeySeqnumLen',
          width: 90,
        },
        {
          headerName: '顺序号的开始数字',
          field: 'KeySeqnumBgn',
          width: 130,
        },
        {
          headerName: '是否加医疗单元号',
          field: 'CanAddUnitid',
          width: 130,
          valueGetter(params) {
            return params.data.CanAddUnitid === 0 ? false : true;
          },
          valueFormatter(params) {
            return params.value ? '√' : '';
          },
        },
        {
          headerName: '数据库连接名',
          field: 'CnName',
          width: 110,
        },
        {
          headerName: '注册方式',
          field: 'RegWay',
          width: 80,
          valueFormatter(params) {
            return params.data.RegWay === 1 ? '预注册' : '运行时注册';
          },
        },
        {
          headerName: '停用标志',
          field: 'StopMark',
          width: 80,
          valueFormatter(params) {
            return params.data.StopMark === 0 ? '' : '√';
          },
        },
      ],
      showToolPanel: false,  // 显示工具栏
      enableSorting: true,//允许排序
      enableColResize: true,//允许调整列宽
      suppressLoadingOverlay: true,// 去掉表格加载数据提示
      suppressNoRowsOverlay: true,// 去掉表格无数据提示
      suppressDragLeaveHidesColumns: true,//防止拖动的时候隐藏表格列
      suppressContextMenu: true,// 阻止表格的右键菜单
      defaultColDef: {
        suppressMenu: true,//隐藏表头菜单
      },
      onRowSelected: this.RowSelected,//行选中回调
      rowSelection: 'single',//只允许单行选中
      isExternalFilterPresent: () => this.filterStart,//是否允许外部筛选
      doesExternalFilterPass: this.IfNodeVisible,//外部筛选条件
      onFilterChanged() {//筛选条件改变回调
        this.api.deselectAll();
        that.selectedRow = false;
      },
      navigateToNextCell: (params) => {// 键盘操作选中行
        let previousCell = params.previousCellDef;
        const suggestedNextCell = params.nextCellDef;
        const KEY_UP = 38;
        const KEY_DOWN = 40;
        const KEY_LEFT = 37;
        const KEY_RIGHT = 39;
        switch (params.key) {
          case KEY_DOWN:
            previousCell = params.previousCellDef;
            this.gridOptions.api.forEachNode((node) => {
              if (previousCell.rowIndex + 1 === node.rowIndex) {
                node.setSelected(true);
              }
            });
            return suggestedNextCell;
          case KEY_UP:
            previousCell = params.previousCellDef;
            this.gridOptions.api.forEachNode((node) => {
              if (previousCell.rowIndex - 1 === node.rowIndex) {
                node.setSelected(true);
              }
            });
            return suggestedNextCell;
          case KEY_LEFT:
          case KEY_RIGHT:
            return suggestedNextCell;
          default:
            break;
        }
      },
    };
  }

  

转载于:https://www.cnblogs.com/LFxanla/p/11103182.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值