找回密码
 立即注册

QQ登录

只需一步,快速开始

wss.

初级会员

49

主题

149

帖子

452

积分

初级会员

积分
452
wss.
初级会员   /  发表于:2020-6-16 18:39  /   查看:3175  /  回复:3
1金币

可能需要有这种格式的,点击打开弹框,但是现在我通过selectChange实现点击出现弹框,但是处于该单元格内再次点击就无效了(这个附件是通过formatItem进行渲染上的),点开弹框操作某些事件会增加改单元格的附件数量,这点还没实现,但是如果使用formatItem的话该如何实现
附件: 您需要 登录 才可以下载或查看,没有帐号?立即注册

最佳答案

查看完整内容

当然可以,cellTemplate是column的一个属性,你可以在任何时间任意地方给这个属性赋值,生成你想要的效果,示例代码如下: 完整代码如下: 测试地址: https://www.grapecity.com/wijmo/demos/Grid/CustomCells/CellMaker/Hyperlinks/purejs

3 个回复

倒序浏览
最佳答案
最佳答案
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-6-16 18:39:25
来自 4#
当然可以,cellTemplate是column的一个属性,你可以在任何时间任意地方给这个属性赋值,生成你想要的效果,示例代码如下:

  1. // 直接设置
  2.     var col = theGrid.columns[3];
  3.     col.cellTemplate = CellMaker.makeLink({
  4.         text: 'Visit <b>${item.country}</b>',
  5.         href: '${item.url}',
  6.         attributes: {
  7.             target: '_blank',
  8.             rel: 'noopener noreferrer',
  9.             tabIndex: -1
  10.         }
  11.         // no need for click handler, the link navigates automatically
  12.     });
复制代码


完整代码如下:

  1. import 'bootstrap.css';
  2. import '@grapecity/wijmo.styles/wijmo.css';
  3. import './styles.css';
  4. import { CellMaker } from '@grapecity/wijmo.grid.cellmaker';
  5. import { FlexGrid } from '@grapecity/wijmo.grid';
  6. import { getData, getCountries } from './data';
  7. document.readyState === 'complete' ? init() : window.onload = init;
  8. function init() {
  9.     var theGrid = new FlexGrid('#theGrid', {
  10.         showMarquee: true,
  11.         selectionMode: 'MultiRange',
  12.         autoGenerateColumns: false,
  13.         columns: [
  14.             { binding: 'id', header: 'ID', isReadOnly: true, width: 80 },
  15.             { binding: 'country', header: 'Country', dataMap: getCountries() },
  16.             // link with bound text and no href (uses click event)
  17.             {
  18.                 header: 'Simple Link',
  19.                 binding: 'country',
  20.                 cellTemplate: CellMaker.makeLink({
  21.                     click: (e, ctx) => alert('Clicked Link ** ' + ctx.item.country + ' **')
  22.                 })
  23.             },
  24.             // link with fixed text and bound href
  25.             {
  26.                 header: 'Real Link',
  27.                 binding: 'country'
  28.             }
  29.         ],
  30.         itemsSource: getData(1000)
  31.     });

  32.     // 直接设置
  33.     var col = theGrid.columns[3];
  34.     col.cellTemplate = CellMaker.makeLink({
  35.         text: 'Visit <b>${item.country}</b>',
  36.         href: '${item.url}',
  37.         attributes: {
  38.             target: '_blank',
  39.             rel: 'noopener noreferrer',
  40.             tabIndex: -1
  41.         }
  42.         // no need for click handler, the link navigates automatically
  43.     });

  44. }
复制代码


测试地址:

https://www.grapecity.com/wijmo/ ... r/Hyperlinks/purejs
回复 使用道具 举报
KevinChen讲师达人认证 悬赏达人认证 SpreadJS 开发认证
论坛元老   /  发表于:2020-6-17 09:07:57
2#
你好,Wijmo 2020 版本原生支持了超链接单元格,参考示例:

https://www.grapecity.com/wijmo/ ... r/Hyperlinks/purejs



官网下载地址:

https://www.grapecity.com.cn/developer/wijmojs/download

本帖子中包含更多资源

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

x
回复 使用道具 举报
wss.
初级会员   /  发表于:2020-6-17 10:32:16
3#
本帖最后由 wss. 于 2020-6-17 11:02 编辑


除了这种直接在列上绑定的,还有没办法外部插入绑定的列上的?意见就是列可能是读数据出来的,但是现在可能直接操作绑定列上不太方便,有没有通过别的方法绑定在列上





底下的图片不用管,我删不掉。。。

本帖子中包含更多资源

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

x
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部