找回密码
 立即注册

QQ登录

只需一步,快速开始

醉汀雨笙

金牌服务用户

21

主题

93

帖子

336

积分

金牌服务用户

积分
336

微信认证勋章

醉汀雨笙
金牌服务用户   /  发表于:2020-8-5 11:44  /   查看:3359  /  回复:6
1金币
實例:
在開始的時候,給定列寬度為200,本身就是小於內容的寬度,所以列折行顯示,當調整列寬的時候,拉長列寬,匯顯示為一行,或者縮小列寬,也是折行顯示,
那麼在開始設定列寬為400(大於內容本身的寬度),縮小列寬,是不會自動折行的。請在實例中驗證。
那麼在開始設定寬度大於內容寬度,為一行顯示時,縮小寬度,如何折行顯示?
附件: 您需要 登录 才可以下载或查看,没有帐号?立即注册

最佳答案

查看完整内容

感谢反馈,本帖结贴了,有新的问题欢迎发新帖交流~

6 个回复

倒序浏览
最佳答案
最佳答案
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-8-5 11:44:56
来自 7#
感谢反馈,本帖结贴了,有新的问题欢迎发新帖交流~
回复 使用道具 举报
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-8-5 13:42:16
2#
你好,实际上当宽度初始化改为400时,这里不是没有折行,而是行高变了,导致折行后看不到折下去的内容,如果您在初始化200时,拖动变窄列宽,也可以发现这个情况。

需要解决的问题是行高自适应,关于行高自适应可以参考:
https://gcdn.grapecity.com.cn/fo ... &extra=page%3D1
回复 使用道具 举报
醉汀雨笙
金牌服务用户   /  发表于:2020-8-5 14:55:46
3#
因为在多网格模式中,设置自适应行高不起作用,才设置列模式的,
你们官网的实列,设置行自适应大小,不起效果


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-8-6 08:51:34
4#
您好,正在处理这个问题,预计2小时左右答复
回复 使用道具 举报
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-8-6 09:52:20
5#
您好,请参考代码示例:

  1. import 'bootstrap.css';
  2. import '@grapecity/wijmo.styles/wijmo.css';
  3. import './styles.css';
  4. import * as wjCore from '@grapecity/wijmo';
  5. import * as wjPdf from '@grapecity/wijmo.pdf';
  6. import * as wjMultiRow from '@grapecity/wijmo.grid.multirow';
  7. import * as wjGridXlsx from '@grapecity/wijmo.grid.xlsx';
  8. import * as wjGridPdf from '@grapecity/wijmo.grid.pdf';
  9. import { generateOrdersSlipData } from './data';
  10. //
  11. document.readyState === 'complete' ? init() : window.onload = init;
  12. //
  13. function init() {
  14.     let data = generateOrdersSlipData();
  15.     let ordersSlip = new wjMultiRow.MultiRow('#ordersSlip', {
  16.         itemsSource: data,
  17.         layoutDefinition: generateLayoutDef(),
  18.         resizedColumn: function(){
  19.             ordersSlip.autoSizeRows()
  20.         }
  21.     });
  22.     ordersSlip.autoSizeRows()

  23.     let cv = ordersSlip.collectionView;
  24.     cv.collectionChanged.addHandler((sender, e) => {
  25.         let unitPrice, quantity;
  26.         if (e.action === wjCore.NotifyCollectionChangedAction.Change && !!e.item) {
  27.             unitPrice = +e.item.unitPrice;
  28.             quantity = +e.item.quantity;
  29.             if (!isNaN(unitPrice) && !isNaN(quantity)) {
  30.                 e.item.amount = unitPrice * quantity;
  31.             }
  32.         }
  33.     });
  34.     // Generate the layout definition for the MultiRow control.
  35.     function generateLayoutDef() {
  36.         return [
  37.             {
  38.                 colspan: 3,
  39.                 cells: [
  40.                     { binding: 'productId', header: 'Product ID', width: 90 },
  41.                     { binding: 'categoryId', header: 'Category ID', width: 90 },
  42.                     { binding: 'categoryName', header: 'Category', width: 90 },
  43.                     { binding: 'productName', header: 'Product Name', colspan: 3 }
  44.                 ]
  45.             },
  46.             {
  47.                 cells: [
  48.                     { binding: 'quantity', header: 'Quantity', width: 140 },
  49.                     { binding: 'packageUnit', header: 'Package Unit', width: 140 }
  50.                 ]
  51.             },
  52.             {
  53.                 cells: [
  54.                     { binding: 'unitPrice', header: 'Unit Price', format: 'c2', width: 80 }
  55.                 ]
  56.             },
  57.             {
  58.                 cells: [
  59.                     { binding: 'amount', header: 'Amount', isReadOnly: true, format: 'c2', width: 80 }
  60.                 ]
  61.             },
  62.             {
  63.                 cells: [
  64.                     { binding: 'shippingId', header: 'Shipping ID', width: 100 },
  65.                     { binding: 'discontinued', header: 'Discontinued', width: 100 }
  66.                 ]
  67.             },
  68.             {
  69.                 cells: [
  70.                     { binding: 'remarks', header: 'Remarks', width: 140, wordWrap:true },
  71.                     { binding: 'description', header: 'Product Description', width: 140, wordWrap:true }
  72.                 ]
  73.             }
  74.         ];
  75.     }
  76.     document.querySelector('#exportXlsx').addEventListener('click', () => {
  77.         wjGridXlsx.FlexGridXlsxConverter.saveAsync(ordersSlip, null, 'OrdersSlip.xlsx');
  78.     });
  79.     document.querySelector('#exportPdf').addEventListener('click', () => {
  80.         let doc = new wjPdf.PdfDocument({
  81.             header: {
  82.                 declarative: {
  83.                     text: '\t&[Page]\\&[Pages]'
  84.                 }
  85.             },
  86.             footer: {
  87.                 declarative: {
  88.                     text: '\t&[Page]\\&[Pages]'
  89.                 }
  90.             },
  91.             ended: function (sender, args) {
  92.                 wjPdf.saveBlob(args.blob, 'OrdersSlip.pdf');
  93.             }
  94.         }), settings = {
  95.             styles: {
  96.                 cellStyle: {
  97.                     backgroundColor: '#ffffff',
  98.                     borderColor: '#c6c6c6'
  99.                 },
  100.                 altCellStyle: {
  101.                     backgroundColor: '#f9f9f9'
  102.                 },
  103.                 headerCellStyle: {
  104.                     backgroundColor: '#eaeaea'
  105.                 }
  106.             }
  107.         };
  108.         wjGridPdf.FlexGridPdfConverter.draw(ordersSlip, doc, null, null, settings);
  109.         doc.end();
  110.     });
  111. }
复制代码


测试地址:
https://demo.grapecity.com.cn/wi ... w/OrdersSlip/purejs

关键代码:
  1.     let ordersSlip = new wjMultiRow.MultiRow('#ordersSlip', {
  2.         itemsSource: data,
  3.         layoutDefinition: generateLayoutDef(),
  4.         resizedColumn: function(){
  5.             ordersSlip.autoSizeRows()
  6.         }
  7.     });
  8.     ordersSlip.autoSizeRows()
复制代码


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
醉汀雨笙
金牌服务用户   /  发表于:2020-8-6 10:46:35
6#
已测试成功!谢谢!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部