找回密码
 立即注册

QQ登录

只需一步,快速开始

wangxuemeicheny

主题

帖子

积分

积分
  • 金币

  • 主题

  • 帖子

[已处理] Spread中checkbox

wangxuemeicheny
  /  发表于:2011-12-14 22:59  /   查看:6520  /  回复:5
提示: 作者被禁止或删除 内容自动屏蔽

5 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2011-12-15 10:24:00
沙发

回复 1# wangxuemeicheny 的帖子

你好,可以通过 CheckBoxCellType OnClientClick 属性定制前台 JS 脚本去实现该功能,代码如下:
后台:
  1.   FarPoint.Web.Spread.CheckBoxCellType checkBoxType1 = new FarPoint.Web.Spread.CheckBoxCellType();
  2.             FarPoint.Web.Spread.CheckBoxCellType checkBoxType2 = new FarPoint.Web.Spread.CheckBoxCellType();
  3.             checkBoxType1.OnClientClick = "postback()";
  4.             FpSpread1.ActiveSheetView.ColumnHeader.Columns[0].CellType = checkBoxType1;
  5.             FpSpread1.ActiveSheetView.Columns[0].CellType = checkBoxType2;
复制代码
前台,其中 FpSpread1_0,0,ch 为列头单元格中 CheckBox id ,可以通过 IE8 开发人员工具查看:
  1.     <script type="text/javascript">
  2.         function postback() {
  3.             var IsChecked = document.getElementById("FpSpread1_0,0,ch")
  4.             if (IsChecked.checked) {
  5.                 for (var i = 0; i < 3; i++) {
  6.                     if (FpSpread1.Cells(i, 0).FpCellType == "CheckBoxCellType") {
  7.                         FpSpread1.SetValue(i, 0,"true",true);
  8.                     }
  9.                 }
  10.             }
  11.             else {
  12.                 for (var i = 0; i < 3; i++) {
  13.                     if (FpSpread1.Cells(i, 0).FpCellType == "CheckBoxCellType") {
  14.                         FpSpread1.SetValue(i, 0, "false", true);
  15.                     }
  16.                 }
  17.             }
  18.         }
  19.     </script>
复制代码
回复 使用道具 举报
wangxuemeicheny
  /  发表于:2011-12-18 07:41:00
板凳
提示: 作者被禁止或删除 内容自动屏蔽
回复 使用道具 举报
wangxuemeicheny
  /  发表于:2011-12-18 07:50:00
地板
提示: 作者被禁止或删除 内容自动屏蔽
回复 使用道具 举报
chcchb
论坛元老   /  发表于:2011-12-18 14:26:00
5#
这个好,貌似我也能用到
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-12-19 09:52:00
6#

回复 5# chcchb 的帖子

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