'稿件发表明细编辑
Dim mr As DataRow '要编辑的稿件发表明细
Dim IsNew As Boolean '此变量用于标记是否要新增明细
If e.GetValues.ContainsKey("uuid") = False OrElse e.GetValues.ContainsKey("addnext") '如果是新增稿件基础,或这包括addnext参数
IsNew = True '将IsNew参数设置为True,表明需要新增稿件发表明细
ElseIf e.GetValues.ContainsKey("uuid") Then '如果传递了稿件发表明细主键
mr = DataTables("稿件发表明细").SQLFind("[uuid]=" & e.GetValues("uuid")) '找出此稿件发表明细进行编辑
End If
If IsNew OrElse mr IsNot Nothing Then
With wb.AddInputGroup("form1","ipg2",iif(IsNew,"新增明细","编辑明细"))
If IsNew Then '如果是新增稿件发表明细
.AddInput("发表时间","发表时间","date")
.AddInput("发表平台","发表平台","text")
.AddInput("平台类型","平台类型","text")
.AddInput("平台级别","平台级别","text")
.AddInput("文章链接","文章链接","text")
Else
.AddHiddenValue("DetailID",mr("uuid")) '插入一个隐藏的稿件发表明细主键,此值将随表单数据一并提交到服务器.
.AddInput("发表时间","发表时间","date").Value = mr("发表时间")
.AddInput("发表平台","发表平台","text").value = mr("发表平台")
.AddInput("平台类型","平台类型","text").Value = mr("平台类型")
.AddInput("平台级别","平台级别","text").Value = mr("平台级别")
.AddInput("文章链接","文章链接","text").Value = mr("文章链接")
End If
End With
End If
'生成稿件发表明细表格
If e.GetValues.ContainsKey("uuid") AndAlso srs.count > 0 Then '如果不是新增稿件基础,且稿件发表明细行数大于0,则生成稿件发表明细表格.
With wb.AddTable("form1","detailTable") '为了区分,明细表的名字设为detailTable
.head.AddRow("发表时间","发表平台","平台级别","文章链接")
.ColWidth="1px,2px,8px,90px"
For Each sr As DataRow In srs
With .body.AddRow()
.Primarykey =sr("uuid")
Dim s As String=sr("发表平台")
Dim s1 As String = sr("平台级别")
Dim s11 As String = sr("文章链接")
If s11.Length > 10 Then
s11 = s11.SubString(0,25) & "..."
End If
.AddCells(sr("发表时间"),s,s1,s11)'逐个单元格增加
End With
Next
End With
'设计菜单
With wb.AddActionSheet("","menu")
.Add("mnudAdd", "增加明细").Attribute="" '调用js函数
.Add("mnuEdit", "编辑明细").Attribute =""
.Add("mnuDelete", "删除明细").Attribute ="""
.Add("mnuCancel","取消","",True)
End With
End If
老师 按照帮助例子中mr定义的是明细表变量 在帮助代码中也没有看见类似pr.save保存代码 如果要写mr.save应该放在哪个位置呢?
因为明细表没有数据 所以明细表格的内容也没有显示出来