页面上会用到2个spread表格,在后台定义时 代码如下
- case "1"
- Dim cb1 As New FarPoint.Web.Spread.CheckBoxCellType()
- Dim cb2 As New FarPoint.Web.Spread.CheckBoxCellType()
- cb1.OnClientClick = "postback(this,'1')"
- cb2.OnClientClick = "selected(this,'1')"
- sheet.ColumnHeader.Cells(1, 0).CellType = cb1
- sheet.Columns(COL_OWNER_SELECT).CellType = cb2
- case else
- Dim cb1 As New FarPoint.Web.Spread.CheckBoxCellType()
- Dim cb2 As New FarPoint.Web.Spread.CheckBoxCellType()
- cb1.OnClientClick = "postback(this,'2')"
- cb2.OnClientClick = "selected(this,'2')"
- sheet.ColumnHeader.Cells(1, 0).CellType = cb1
- sheet.Columns(COL_OWNER_SELECT).CellType = cb2
复制代码 页面js如下:- function postback(obj, str) {
- var spread, btnRemove;
- switch (str) {
- case "1":
- spread = document.getElementById("FpSpread1");
- btnRemove = document.getElementById("btnA");
- break;
- case "2":
- spread = document.getElementById("FpSpread2");
- btnRemove = document.getElementById("btnB");
- break;
- }
- if (obj.checked) {
- obj.checked = false;
- btnRemove.className = "ctlButtonNot";
- btnRemove.disabled = true;
- for (var i = 0; i < spread.GetRowCount(); i++) {
- spread.SetValue(i, 0, "false", true);
- }
- }
- else {
- obj.checked = true;
- btnRemove.className = "ctlButton";
- btnRemove.disabled = false;
- for (i = 0; i < spread.GetRowCount(); i++) {
- spread.SetValue(i, 0, "true", true);
- }
- }
复制代码
后台在FpSpread_UpdateCommand中又重新把datatable放入到对应的spread绑定了一边,没有出现全选以及按钮样式改变的效果 |
|