Foxtable(狐表)用户栏目专家坐堂 → 增加行之后刷新表格


  共有148人关注过本帖树形打印复制链接

主题:增加行之后刷新表格

帅哥哟,离线,有人找我吗?
有点蓝
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:87532 积分:444197 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/6/23 22:52:00 [只看该作者]

我把代码复制过来,自己理解一下


httprequests事件

Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","tongji.htm")
        With wb.AddInputGroup("form1","ipg1","销售统计")
            .AddSelect("水平分组","水 平分组","产品|客户|雇员")
            .AddSelect("垂直分组","垂直分组","产品|[客户]|雇员")
            .AddSelect("统计列","统计列","数量|金额")
        End With
        With wb.AddInputGroup("form1","ipg2","动态赋值")
            .AddInput("xm1","值1","text")
            .AddInput("xm2","值2","text")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "统计", "button").Attribute= ""
        End With
        wb.AppendHTML("<div id='p1' style='margin:0.5em'></div>") '插入一个div,用于显示服务器返回的 页面
        wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
        e.WriteString(wb.Build)
    Case "tongji.htm"
        Dim wb As New weui
        If e.PostValues.ContainsKey("垂直分组") AndAlso e.PostValues.ContainsKey("水平分组") AndAlso e.PostValues.ContainsKey("统计列") Then
            Dim b As New CrossTableBuilder("统计表1",DataTables("订单"))
            b.HGroups.AddDef(e.PostValues("水平分组"))
            b.VGroups.AddDef(e.PostValues("垂直分组"))
            b.Totals.AddDef(e.PostValues("统计列"))
            Dim dt As DataTable = b.Build(True)
            With wb.AddTable("","Table1")
                Dim lst As new List(of String)
                For Each dc As DataCol In dt.DataCols
                    lst.Add(IIF(dc.Caption = "",dc.Name,dc.Caption))
                Next
                .head.AddRow(lst.ToArray)
                For Each dr As DataRow In dt.DataRows
                    lst.Clear
                    For Each dc As DataCol In dt.DataCols
                        lst.Add(dr(dc.Name))
                    Next
                    .body.AddRow(lst.ToArray).Attribute= ""
                Next
            End With
        Else
            wb.InsertHTML("请按输入分组列和统计列!")
        End If
        e.WriteString(wb.Build)
End Select


ajaxform.js文件
function tongji(){
    var result = submitAjaxForm('form1','',false);
    document.getElementById("p1").innerHTML=result;
    bindTable();
}

function bindTable() {
    var eles = document.querySelectorAll(".fox_actionsheet");
    for (var i = 0; i < eles.length; i++) {
        eles[i].onclick = hide;
    }
    eles = document.getElementsByClassName("fox_table")
    for (var i = 0; i < eles.length; i++) {
        eles[i].onmousedown = tableMouseDown;
        eles[i].rowSel = -1;
        eles[i].colSel = -1;
        if (eles[i].hasAttribute("data-pagenumber")) {
            eles[i].pagenumber = eles[i].attributes["data-pagenumber"].value;
        }
    }
    eles = document.getElementsByClassName("weui_mask_transition");
    for (var i = 0; i < eles.length; i++) {
        eles[i].addEventListener("transitionend", hideActionMask);
    }
}
function setvalues(){
    document.getElementById("xm1").value = table1.rows[table1.rowSel].cells[0].innerHTML;
    document.getElementById("xm2").value = table1.rows[table1.rowSel].cells[1].innerHTML;
}

 回到顶部
客人(59.45.*.*)
  12楼


  发帖心情 Post By:2022/6/24 9:46:00 [只看该作者]

Dim e As RequestEventArgs = args(0)



Dim wb As New weui
wb.AddPageTitle("","ph1","增加压舱水","")
Dim PageURL = "List2.htm?page=" & e.GetValues("page") &  "&key=" & e.GetValues("list2key")


If e.PostValues.Count = 0 Then '生成增加订单网页
    wb.AddForm("", "form1", "addnew3.htm?key=" & e.getvalues("key") & "&list2key=" & e.GetValues("list2key"))
    With wb.AddInputGroup("form1","ipg1","压舱水")
        '.AddHiddenValue("sureyid",id)
            '.AddHiddenValue("次数",idx)
        '
        .AddInput("tankno","舱号tankno","text")
        .AddInput("obvd","压舱水obvd","number").Step = "0.001"
        With .AddInput("correct","修正correct","number")
            .Step = "0.001"
            .value="0"
        End With
        .AddInput("tovcubmeter","体积tovcubmeter","number").Step = "0.001"
        With .AddInput("density","密度density","number")
            .Step = "0.001"
            .value="1.02"
        End With
    End With
    With wb.AddButtonGroup("form1","btg1",True)
        .Add("btn1", "确定", "button").Attribute= ""
    End With
   
    'With wb.AddDialog("", "dlg1", "提示", "增加成功,是否继续增加?") '增加订单成功提示框
        '            .AddButton("btnYes", "是").Attribute = ""
        '            .AddButton("btnNo", "否", PageURL).Kind = 1
    '        End With
    With wb.AddDialog("", "dlg2", "错误", "") '增加订单失败提示框
        .AddButton("btnOK", "确定")
    End With
'    wb.AppendHTML("<div id='p1' style='margin:0.5em'></div>")
    wb.AppendHTML("<script src='./lib/ycsbg.js'></script>") '引入脚本文件
   
   
'    Dim pr1 As DataRow
'    Dim id1 As String
'    pr1 = DataTables("操作表").SQLFind("[_Identify] =" & e.getvalues("key"))
'    If pr1 IsNot Nothing Then
'        id1 = pr1("sureyidtimes")
'    End If
'    With wb.AddTable("", "Table1")
'        '按日期顺序列出客户CS01的订单,仅显示产品/数量/单价/日期/审核等五列
'        .CreateFromDataTable(DataTables("压舱水"), False, "sureyidtimes='" & id1 & "'", "次数 desc", "次数", "tankno", "obvd", "tovcubmeter", "weightmetricton")
'    End With
    e.WriteString(wb.Build)
   
   
Else '保存新增的订单
   
    Dim dr As DataRow = DataTables("压舱水").AddNew()
    '调取list1中的行id
    Dim pr As DataRow
    Dim id As String
    pr = DataTables("操作表").SQLFind("[_Identify] =" & e.getvalues("key"))
    If pr IsNot Nothing Then
        id = pr("sureyidtimes")
    End If
    'MessageBox.Show(id)
    ''计算sureyidtimes
    Dim max As Integer
    Dim idx As Integer
    max= DataTables("压舱水").SQLCompute("max(次数)","sureyidtimes='" & id & "'")
   
    If max > 0 Then '如果存在最大次数
        idx = max+1 '获得最大次数的后三位顺序号,并加1
    Else
        idx = 1 '否则顺序号等于1
    End If
   
   
    dr("sureyidtimes") = id
    dr("时间") = Date.Today()
    dr("次数")=idx
    dr("压舱水编码次数")=id+CStr(idx)
    Dim nms() As String = {"tankno","obvd","correct","tovcubmeter","density"}
    For Each nm As String In nms
        dr(nm) = e.PostValues(nm)
    Next
    '    dr.Save()
    ''计算结果
    If dr.IsNull("obvd") And  dr.IsNull("correct") Then
        dr("corrd") = Nothing
    Else
        dr("corrd") = Math.Round(dr("obvd")+dr("correct")/100,2)
    End If
    '' "tovcubmeter","density"  ''weightmetricton,操作表bw获取公式
    If dr.IsNull("tovcubmeter") Or dr.IsNull("density") Then
        dr("weightmetricton") = Nothing
    Else
        dr("weightmetricton") = Math.Round(dr("tovcubmeter")*dr("density"),2)
    End If
   
    dr.Save()
    e.WriteString("OK") '返回增加成功消息
    With wb.AddTable("", "Table1")
        '按日期顺序列出客户CS01的订单,仅显示产品/数量/单价/日期/审核等五列
       .CreateFromDataTable(DataTables("压舱水"), False, "sureyidtimes='" & id & "'", "次数 desc", "次数", "tankno", "obvd", "tovcubmeter", "weightmetricton")
    End With
    e.WriteString(wb.Build)
    '    With wb.AddMsgPage("","msgpage","增加成功", "压舱水增加成功") '增加订单成功提示信息
        '        .AddButton("btn2","继续增加","addnew3.htm?key=" & e.getvalues("key") & "&list2key=" & e.GetValues("list2key"))
        '        .AddButton("btn1","返回",PageURL)
    '    End With
End If
'e.WriteString(wb.Build) '生成网页


 


我把这句加在后边,为什么不出现表格呢?


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:87532 积分:444197 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/6/24 10:12:00 [只看该作者]

不能重复调用e.WriteString,去掉e.WriteString("OK") 

 回到顶部
总数 13 上一页 1 2