第一步:重写原有的Delete方法,在服务端中为Delete.onclick指定自己的MyDelete方法- protected override void Render(HtmlTextWriter writer)
- {
- WebControl delButton = FpSpreadMonthExecution.FindControl("Delete") as WebControl;
- if (delButton != null)
- {
- delButton.Attributes.Add("onclick", "MyDelete()");
- }
- base.Render(writer);
- }
复制代码 第二步:在页面中添加MyDelete方法的实现- <script language="javascript" type="text/javascript">
- function MyDelete() {
- var ss = FpSpread("FpSpreadMonthExecution");
- if (ss.GetSelectedRange().type = "Row") {
- var rowstart = ss.GetSelectedRange().row
- var rowcount = ss.GetSelectedRange().rowCount
- for (var row = rowstart + rowcount - 1; row >= rowstart; row--) {
- ss.ActiveRow = row;
- ss.Delete();
- }
- }
- }
- </script>
复制代码 以上是一个简约代码,详细逻辑可根据你们的业务已经修改 |