你好,可以通过 CheckBoxCellType OnClientClick 属性定制前台 JS 脚本去实现该功能,代码如下:
后台:- FarPoint.Web.Spread.CheckBoxCellType checkBoxType1 = new FarPoint.Web.Spread.CheckBoxCellType();
- FarPoint.Web.Spread.CheckBoxCellType checkBoxType2 = new FarPoint.Web.Spread.CheckBoxCellType();
- checkBoxType1.OnClientClick = "postback()";
- FpSpread1.ActiveSheetView.ColumnHeader.Columns[0].CellType = checkBoxType1;
- FpSpread1.ActiveSheetView.Columns[0].CellType = checkBoxType2;
复制代码 前台,其中 FpSpread1_0,0,ch 为列头单元格中 CheckBox id ,可以通过 IE8 开发人员工具查看:- <script type="text/javascript">
- function postback() {
- var IsChecked = document.getElementById("FpSpread1_0,0,ch")
- if (IsChecked.checked) {
- for (var i = 0; i < 3; i++) {
- if (FpSpread1.Cells(i, 0).FpCellType == "CheckBoxCellType") {
- FpSpread1.SetValue(i, 0,"true",true);
- }
- }
- }
- else {
- for (var i = 0; i < 3; i++) {
- if (FpSpread1.Cells(i, 0).FpCellType == "CheckBoxCellType") {
- FpSpread1.SetValue(i, 0, "false", true);
- }
- }
- }
- }
- </script>
复制代码 |