找回密码
 立即注册

QQ登录

只需一步,快速开始

dllyzs

注册会员

11

主题

26

帖子

109

积分

注册会员

积分
109
dllyzs
注册会员   /  发表于:2020-12-17 11:00  /   查看:2670  /  回复:1
5金币
本帖最后由 dllyzs 于 2020-12-31 15:02 编辑

我想在查询结果为空时,显示一条空的记录,但是数据行合并后,表头部分发生了变化。
需要在合并的MergeManager中对表头进行设置?
测试地址是
https://demo.grapecity.com.cn/wijmo/demos/Grid/MultiRow/LayoutDefinition/purejs

使用的代码是
  1. import 'bootstrap.css';
  2. import '@grapecity/wijmo.styles/wijmo.css';
  3. import './styles.css';
  4. //
  5. import * as wjCore from '@grapecity/wijmo';
  6. import * as wjInput from '@grapecity/wijmo.input';
  7. import * as wjGridCore from '@grapecity/wijmo.grid';
  8. import * as wjMultiRow from '@grapecity/wijmo.grid.multirow';
  9. import { generateAppData } from './data';
  10. //
  11. document.readyState === 'complete' ? init() : window.onload = init;
  12. //
  13. function init() {
  14.     let appData = generateAppData();
  15.     let orders = appData.orders;
  16.     let layoutDefs = appData.layoutDefs;
  17.     let currentLayout = appData.layoutDefs.currentItem;

  18.     orders = [];
  19.     let initData = {};
  20.     initData[currentLayout.def[0].cells[0].binding] = '检索数据不存在';
  21.     orders.push(initData);
  22.    
  23.     let multirow = new wjMultiRow.MultiRow('#multirow', {
  24.         itemsSource: orders,
  25.         layoutDefinition: currentLayout.def
  26.     });
  27.     // multirow.rows.push(new wjMultiRow.Row());
  28.    
  29.     var mm = new wjGridCore.MergeManager(multirow);
  30.     mm.getMergedRange = function (panel, r, c, clip = true) {
  31.         if (panel.cellType == wjGridCore.CellType.Cell) {
  32.             if (r % 2 == 0) {
  33.                 return new wjGridCore.CellRange(r, 0, r + 2 - 1, panel.grid.columns.length - 1);
  34.             } else {
  35.                 return new wjGridCore.CellRange(r - (2 - 1), 0, r, panel.grid.columns.length - 1);
  36.             }
  37.         }
  38.     };
  39.     multirow.mergeManager = mm;

  40.     let ldComboBox = new wjInput.ComboBox('#ldComboBox', {
  41.         itemsSource: layoutDefs,
  42.         displayMemberPath: 'name'
  43.     });
  44.     updateDescription();
  45.     layoutDefs.currentChanged.addHandler(() => {
  46.         currentLayout = appData.layoutDefs.currentItem;
  47.         updateMultirow();
  48.         updateDescription();
  49.     });
  50.     //
  51.     function updateMultirow() {
  52.         multirow.layoutDefinition = currentLayout.def;
  53.     }
  54.     //
  55.     function updateDescription() {
  56.         wjCore.setText(document.querySelector('#desc'), currentLayout.description);
  57.     }
  58. }
复制代码


1 个回复

倒序浏览
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-12-17 17:42:06
沙发
您好,这个问题还需要一些时间调研,预计明天下午前回复。谢谢~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部