5金币
本帖最后由 dllyzs 于 2020-12-31 15:02 编辑
我想在查询结果为空时,显示一条空的记录,但是数据行合并后,表头部分发生了变化。
需要在合并的MergeManager中对表头进行设置?
测试地址是
https://demo.grapecity.com.cn/wijmo/demos/Grid/MultiRow/LayoutDefinition/purejs
使用的代码是
- import 'bootstrap.css';
- import '@grapecity/wijmo.styles/wijmo.css';
- import './styles.css';
- //
- import * as wjCore from '@grapecity/wijmo';
- import * as wjInput from '@grapecity/wijmo.input';
- import * as wjGridCore from '@grapecity/wijmo.grid';
- import * as wjMultiRow from '@grapecity/wijmo.grid.multirow';
- import { generateAppData } from './data';
- //
- document.readyState === 'complete' ? init() : window.onload = init;
- //
- function init() {
- let appData = generateAppData();
- let orders = appData.orders;
- let layoutDefs = appData.layoutDefs;
- let currentLayout = appData.layoutDefs.currentItem;
- orders = [];
- let initData = {};
- initData[currentLayout.def[0].cells[0].binding] = '检索数据不存在';
- orders.push(initData);
-
- let multirow = new wjMultiRow.MultiRow('#multirow', {
- itemsSource: orders,
- layoutDefinition: currentLayout.def
- });
- // multirow.rows.push(new wjMultiRow.Row());
-
- var mm = new wjGridCore.MergeManager(multirow);
- mm.getMergedRange = function (panel, r, c, clip = true) {
- if (panel.cellType == wjGridCore.CellType.Cell) {
- if (r % 2 == 0) {
- return new wjGridCore.CellRange(r, 0, r + 2 - 1, panel.grid.columns.length - 1);
- } else {
- return new wjGridCore.CellRange(r - (2 - 1), 0, r, panel.grid.columns.length - 1);
- }
- }
- };
- multirow.mergeManager = mm;
- let ldComboBox = new wjInput.ComboBox('#ldComboBox', {
- itemsSource: layoutDefs,
- displayMemberPath: 'name'
- });
- updateDescription();
- layoutDefs.currentChanged.addHandler(() => {
- currentLayout = appData.layoutDefs.currentItem;
- updateMultirow();
- updateDescription();
- });
- //
- function updateMultirow() {
- multirow.layoutDefinition = currentLayout.def;
- }
- //
- function updateDescription() {
- wjCore.setText(document.querySelector('#desc'), currentLayout.description);
- }
- }
复制代码
|
|