以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- JS文件传递备注列(内装img图片名称) 栏位 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=110391) |
-- 作者:lanbor -- 发布时间:2017/12/1 22:01:00 -- JS文件传递备注列(内装img图片名称) 栏位 \'-----以下是采购单查询网页 po_view.htm 的第二个表格内容(采购单行信息)。 目的:当用户点击采购单行的时候,希望在表的下方,已经准备好的图片区域显示订单所所对应的物料图片。 If srs.Count>0 Then wb.insertHTML("form1","采购单行信息") With wb.AddTable("form1","Table2") .AfterSelChange = "po_view8()" .Highlight= 1 .Alternate = 2 .head.AddRow("名称","规格","数量","单位","单价","金额","收") For Each sr As DataRow In srs With .Body.AddRow(sr("po_imc"),sr("po_igg")) .addcell(sr("po_isl"),"class=\'alignC\'") .addcell(sr("po_idw"),"class=\'alignC\'") .addcell(sr("po_idj"),"class=\'alignR\'") .AddCell(sr("po_isl") * sr("po_idj"),"class=\'alignR\'") .addcell(sr("po_iok"),"class=\'alignC\'") .Primarykey = sr("po_iid") \'----改为由物料主键作为表格key End With Next End With End If Dim img001 As new List(of String) With wb.AddInputGroup("form1","ipg4","库存图片") With .AddUploader("imgid","",True) .allowadd=False \'关闭上传功能 Dim path As String = FilePath & "Photo\\" \'.addimage(img001) \' <<------ 这里应该如何接收来自 JS函数po_view8()返回的图片集合值? End With End With ’----以下是JS函数:po_view8() function po_view8(){ var obj = new Object();
obj.key=table2.primarykey;
var result = sendAjaxJSON(obj,"item_getImg.htm","",false);
alert(result); //测试结果有值(图片名称)
if (result){ document.getElementById(\'img001\').value=result; \'-<<------这里如何接收item_getImg() 返回的img01的值? } } ’----以下是自定义函数:item_getImg() Dim e As RequestEventArgs = args(0) Dim wb As New WeUI Dim sb As New StringBuilder Dim jo As JO bject = JObject.Parse(e.PlainText) Dim key As Integer = jo("key") Dim dr As DataRow = Data Tables("item99").SQLF ind("[_Identify] = " & key) If dr IsNot Nothing Then e.WriteString(dr("img01")) \'dr("img01") 列中装的多个文件名称 End If 请教专家:问题点如红颜色部份文字。 先谢谢专家! [此贴子已经被作者于2017/12/1 22:04:55编辑过]
|
-- 作者:有点蓝 -- 发布时间:2017/12/1 23:25:00 -- 方法1,刷新整个页面 方法2,仅刷新图片,这个比较麻烦 假设Photo位于\\web目录下 自定义函数:item_getImg() Dim e As RequestEventArgs = args(0) Dim wb As New WeUI Dim sb As New StringBuilder Dim jo As JO bject = JObject.Parse(e.PlainText) Dim key As Integer = jo("key") Dim dr As DataRow = Data Tables("item99").SQLF ind("[_Identify] = " & key) If dr IsNot Nothing Then Dim jo As New JObject jo("li") = CExp("<li data-gid=\'imgid_gallery\' data-image=\'./Photo/{0}\' class=\'weui_uploader_file\' style=\'background-image:url(./Photo/{0})\'></li>",dr("img01")) jo("ga") = CExp("./Photo/{0}",dr("img01")) e.WriteString(jo.ToString) \'dr("img01") 列中装的多个文件名称 End If JS函数:po_view8() function po_view8(){ var obj = new Object();
obj.key=table2.primarykey;
var result = sendAjaxJSON(obj,"item_getImg.htm","",false);
alert(result); //测试结果有值(图片名称)
if (result){
var pics = val(\'(\' + result + \')\');
document.getElementById("imgid_thumbnails").innerHTML = pics.li;
document.getElementById("imgid_gallery").setAttribute("data-images",pics.ga);
} } 具体可以参考实例:http://wechat.foxtable.com:9009/WebHelp/scr/we0130.htm,里库存查询的例子 |
-- 作者:lanbor -- 发布时间:2017/12/1 23:36:00 -- 多谢专家快速指教! 多谢专家快速指教! 我再认真学习一下您提供的方法!
|