老师,在对订单明细当前行修改时,怎么在编辑明细时设置如新增明细那样的多级关联功能,并且当前行对应列的旧值怎么自动设置为列表项目的初始值?下面绿色代码如何修改?
.......
'订单明细编辑
Dim mr As DataRow '要编辑的订单明细
Dim IsNew As Boolean '此变量用于标记是否要新增明细
If e.GetValues.ContainsKey("oid") = False OrElse e.GetValues.ContainsKey("addnext") '如果是新增订单,或这包括addnext参数
IsNew = True '将IsNew参数设置为True,表明需要新增订单明细
ElseIf e.GetValues.ContainsKey("did") Then '如果传递了订单明细主键
mr = Datatables("订单明细").SQLFind("[_Identify]=" & e.GetValues("did")) '找出此订单明细进行编辑
End If
If IsNew OrElse mr IsNot Nothing Then
cmd.CommandText = "SELECT * F ro m {产品资料}"
dt = cmd.ExecuteReader()
With wb.AddInputGroup("form1","ipg2",iif(IsNew,"新增明细","编辑明细"))
'.Attribute = "" '调用js函数,自动计算金额
If IsNew Then '如果是新增订单明细
With .AddSelect("型号","型号","|" & dt.GetComboListString("型号"))
.Attribute = """
End With
With .AddSelect("塔线型号","塔线型号","")
.Attribute = """
End With
.AddSelect("金属条型号","金属条型号","")
.AddInput("数量","数量","number")
Else
.AddHiddenValue("DetailID",mr("_Identify")) '插入一个隐藏的订单明细主键,此值将随表单数据一并提交到服务器.
Dim s1 as string = "|" & dt.GetComboListString("型号") & "|"
s1 = s1.replace("|" & mr("型号") & "|","|[" & mr("型号") & "]|")
With .AddSelect("型号","型号",s1.trimend("|"))
.Attribute = """
End With
Dim s2 as string = "|" & dt.GetComboListString("塔线型号","型号='" & e.PostValues("型号") & "'") & "|"
s2 = s2.replace("|" & mr("塔线型号") & "|","|[" & mr("塔线型号") & "]|")
With .AddSelect("塔线型号","塔线型号",s2.trimend("|"))
.Attribute = """
End With
'Dim Filter As String = "型号='" & e.PostValues("型号") & "' And 塔线型号='" & e.PostValues("塔线型号") & "'"
Dim s3 as string = "|" & dt.GetComboListString("金属条型号",Filter) & "'") & "|"
s3 = s3.replace("|" & mr("金属条型号") & "|","|[" & mr("金属条型号") & "]|")
.AddSelect("金属条型号","金属条型号",s3.trimend("|"))
.AddInput("数量","数量","number").value = mr("数量")
End If
End With
End If
.......
关联表:
此主题相关图片如下:1.png
此主题相关图片如下:2.png