以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 移动setAjaxOptions求代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=98573) |
||||
-- 作者:qwz405 -- 发布时间:2017/4/1 11:34:00 -- 移动setAjaxOptions求代码 需要的效果是:同一类型/系列的不同机型作对比。 现在机型1/机型2无法获得需要的下拉列表,代码需要如何修改?
一.窗口代码如下: Dim wb As New WeUI wb.AddPageTitle("","choose","规格型号","") \'标题 wb.AddForm("","form1","choose.htm") \'表单 With wb.AddInputGroup("form1","ipg1","选择规格型号") \'列表 \'DataTables("机器规格").LoadFilter = "" \'加载所有数据 \'DataTables("机器规格").Load() With .AddSelect("类型","类型","|" & DataTables("机器规格").SQLGetComboListString("类型")) .Attribute = """ \'setAjaxOptions用于根据后台数据动态生成列表项目 End With With .AddSelect("系列","系列","") .Attribute = """ End With .AddSelect("机型1","机型1","") .AddSelect("机型2","机型2","") End With With wb.AddButtonGroup("form1","btg1",False) \'按钮 .Add("btn1", "对比", "submit") .Add("btn2", "返回","", "./product.htm") \'跳转到产品首页..也就是上一页 End With e.WriteString(wb.Build) \'生成网页 二:getchoose页面代码如下: Dim vals As String If e.PostValues.Count = 1 Then vals = "|" & DataTables("机器规格").SQLGetComboListString("系列","类型 = \'" & e.PostValues("类型") & "\'") ElseIf e.PostValues.Count = 2 Then \'当选择<系统>框值时,机型1/机型2的下拉取值框作如下变动 If e.PostValues.ContainsKey("机型1") Then Dim Filter As String = "类型 = \'" & e.PostValues("类型") & "\' And 系列 = \'" & e.PostValues("系列") & "\'" vals = "|" & DataTables("机器规格").SQLGetComboListString("机型", Filter) ElseIf e.PostValues.ContainsKey("机型2") Then Dim Filter As String = "类型 = \'" & e.PostValues("类型") & "\' And 系列 = \'" & e.PostValues("系列") & "\'" vals = "|" & DataTables("机器规格").SQLGetComboListString("机型", Filter) End If End If e.WriteString(vals) [此贴子已经被作者于2017/4/1 14:02:40编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2017/4/1 14:49:00 -- web/lib/ajaxform.js function submitForm(){
setAjaxOptions(\'机型1\',\'getmodel.htm\',\'类型\',\'系列\',false);
setAjaxOptions(\'机型2\',\'getmodel.htm\',\'类型\',\'系列\',false); } HttpRequest ......事件头代码略 Select Case e.path Case "choose.htm","" \'2.选择类型/系列/机型 Dim wb As New WeUI wb.AddPageTitle("","choose","规格型号","") \'标题 wb.AddForm("","form1","choose.htm") \'表单 With wb.AddInputGroup("form1","ipg1","选择规格型号") \'列表 \'DataTables("机器规格").LoadFilter = "" \'加载所有数据 \'DataTables("机器规格").Load() With .AddSelect("类型","类型","|" & DataTables("机器规格").SQLGetComboListString("类型")) .Attribute = "onchange=""setAjaxOptions(\'系列\',\'getmodel.htm\',\'类型\',false)""" \'setAjaxOptions用于根据后台数据动态生成列表项目 End With With .AddSelect("系列","系列","") .Attribute = "onchange=\'submitForm()\'" End With .AddSelect("机型1","机型1","") .AddSelect("机型2","机型2","") End With With wb.AddButtonGroup("form1","btg1",False) \'按钮 .Add("btn1", "对比", "submit") .Add("btn2", "返回","", "./product.htm") \'跳转到产品首页..也就是上一页 End With wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") e.WriteString(wb.Build) \'生成网页 Case "getmodel.htm" \'2.系列/机型下拉列表 Dim vals As String If e.PostValues.Count = 1 Then vals = "|" & DataTables("机器规格").SQLGetComboListString("系列","类型 = \'" & e.PostValues("类型") & "\'") ElseIf e.PostValues.Count = 2 Then \'当选择<系统>框值时,机型1/机型2的下拉取值框作如下变动 Dim Filter As String = "类型 = \'" & e.PostValues("类型") & "\' And 系列 = \'" & e.PostValues("系列") & "\'" vals = "|" & DataTables("机器规格").SQLGetComboListString("机型", Filter) End If e.WriteString(vals) End Select [此贴子已经被作者于2017/4/1 14:49:45编辑过]
|
||||
-- 作者:qwz405 -- 发布时间:2017/4/1 18:09:00 -- 再次请教:是否可以做到行列数据对调? 一.选择比对的机型(表格中列的项目后续还会不断增加)。 二.将数据行列对调,方便手机端浏览。 三.web/lib/ajaxform.js代码如下: function getmodelForm(){
setAjaxOptions(\'机型1\',\'getmodel.htm\',\'类型\',\'系列\',false);
setAjaxOptions(\'机型2\',\'getmodel.htm\',\'类型\',\'系列\',false); } function getchoose(){ var result=submitAjaxFileds("valid.htm","","类型","系列","机型1","机型2",false); if(result=="OK"){ return true; } else{ showTopTips("toptip1",result,2500); return false; } } 四.Httprequest数据如下所示: Dim fl As String = "e:\\baidu\\web\\" & e.path If filesys.FileExists(fl) Dim idx As Integer = fl.LastIndexOf(".") Dim ext As String = fl.SubString(idx) Select Case ext Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar" e.WriteFile(fl) Return \'这里必须返回 End Select End If Select Case e.path Case "choose.htm","" \'2.选择类型/系列/机型 Dim wb As New WeUI wb.AddPageTitle("","choose","规格型号","***") \'标题 wb.AddForm("","form1","getchoose.htm").Attribute="" \'表单...接收此表单数据页面为:getchoose.htm...使用js脚本文件,判断是否有输入完整数据 With wb.AddInputGroup("form1","ipg1","选择规格型号") \'列表 With .AddSelect("类型","类型","|" & DataTables("机器规格").SQLGetComboListString("类型")) \'GetComboListString是从后台所有数据中提取. .Attribute = """ \'setAjaxOptions用于根据后台数据动态生成列表项目 End With With .AddSelect("系列","系列","") \'使用js脚本文件,在./web/lib文件夹中 .Attribute = "" End With .AddSelect("机型1","机型1","") .AddSelect("机型2","机型2","") End With With wb.AddButtonGroup("form1","btg1",False) \'按钮 .Add("btn1", "对比", "submit") \'跳转至比对页面 .Add("btn2", "返回","", "./product.htm") \'跳转到产品首页..也就是上一页 End With wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 Case "getmodel.htm" \'3.系列/机型下拉列表 Dim vals As String If e.PostValues.Count = 1 Then vals = "|" & DataTables("机器规格").SQLGetComboListString("系列","类型 = \'" & e.PostValues("类型") & "\'") ElseIf e.PostValues.Count = 2 Then \'当选择<系统>框值时,机型1/机型2的下拉取值框作如下变动 Dim Filter As String = "类型 = \'" & e.PostValues("类型") & "\' And 系列 = \'" & e.PostValues("系列") & "\'" vals = "|" & DataTables("机器规格").SQLGetComboListString("机型", Filter) End If e.WriteString(vals) Case "getchoose.htm" \'3.对已选择的机型进行对比 Dim wb As New WeUI If e.PostValues.ContainsKey("类型") AndAlso e.PostValues.ContainsKey("系列") AndAlso e.PostValues.ContainsKey("机型1") AndAlso e.PostValues.ContainsKey("机型2") Then e.WriteString("我要开始对比了!下面的不会写,无法产生资料:(") \' ***** \' ***** \' ***** Else e.WriteString("数据不完整,无法对比.请您重新选择!") End If End Select 五.另外,未输入完整数据的错误提示,文字很小。没有像帮助中那样,红底色显示在上方。
[此贴子已经被作者于2017/4/1 18:12:31编辑过]
|
||||
-- 作者:有点色 -- 发布时间:2017/4/2 12:10:00 -- 1、2、你要对调数据,那你就生成那一个表,参考 http://www.foxtable.com/webhelp/scr/2965.htm
3、4、5,单独做一个例子上来,把你的web文件夹、项目一起打包发上来说明你要做什么。
|
||||
-- 作者:qwz405 -- 发布时间:2017/4/3 14:10:00 -- 麻烦老师:对选择的2个机型,输出对比结果。
[此贴子已经被作者于2017/4/4 13:06:43编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2017/4/4 15:01:00 -- Case "getchoose.htm" \'3.对已选择的机型进行对比 Dim wb As New WeUI If e.PostValues.ContainsKey("类型") AndAlso e.PostValues.ContainsKey("系列") AndAlso e.PostValues.ContainsKey("机型1") AndAlso e.PostValues.ContainsKey("机型2") Then Dim dtb As New DataTableBuilder("统计") dtb.AddDef("属性", Gettype(String), 16) dtb.AddDef("机型1", Gettype(String), 32) dtb.AddDef("机型2", Gettype(String), 32) Dim dt As DataTable = dtb.Build(True) Dim dr1 As DataRow = DataTables("机器规格").Find("机型=\'" & e.PostValues("机型1") &"\'") Dim dr2 As DataRow = DataTables("机器规格").Find("机型=\'" & e.PostValues("机型2") &"\'") If dr1 IsNot Nothing AndAlso dr2 IsNot Nothing Then Dim dr As DataRow For Each c As DataCol In DataTables("机器规格").DataCols dr = dt.AddNew() dr("属性") = c.Name dr("机型1") = dr1(c.Name) dr("机型2") = dr2(c.Name) Next End If With wb.AddTable("","Table1") \'按日期顺序列出客户CS01的订单,仅显示产品/数量/单价/日期/审核等五列 .CreateFromDataTable(dt) End With e.WriteString(wb.Build) Else e.WriteString("数据不完整,无法对比.请您重新选择!") End If
|
||||
-- 作者:qwz405 -- 发布时间:2017/4/4 15:27:00 -- 非常感谢老师。 还有个问题请您帮忙,未输入选择完整数据时错误提示,文字很小。没有像帮助中那样,红底色显示在上方。 [此贴子已经被作者于2017/4/4 15:27:14编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2017/4/4 15:33:00 -- 参考:http://www.foxtable.com/mobilehelp/scr/0083.htm |