给表格加上菜单

给表加上菜单的代码很简单,我们首先要设计一个ActionSheet,然后将此ActionSheet的ID设置为表的ActiveSheet属性即可。

例如HttpRequest事件代码:

Select Case e.Path
    Case "table.htm"
        Dim wb As New WeUI
        With wb.AddTable("","Table1")
            .head.AddRow(
"
部门","姓名","年龄","电话","地址") '表头
            .body.AddRow(
"
技术部","张三","36","110","中国北京") '数据
            .body.AddRow(
"
技术部","李四","38","110","中国上海")
            .body.AddRow(
"
技术部","王五","39","110","中国深圳")
            .body.AddRow(
"
生产部","赵六","39","110","中国深圳")
            .body.AddRow(
"
生产部","刘七","39","110","中国深圳")
            .ActiveSheet = "menu"
'
指定菜单
        End With
        With wb.AddActionSheet("","menu")
'
设计菜单
            .Add("mnudAdd",
"
增加订单")
            .Add("mnuEdit",
"
编辑订单")
            .Add("mnuDelete",
"
删除订单")
            .Add("mnuCancel",
"
取消","",True)
        End With
        e.WriteString(wb.Build)

End
Select

打开网页后,先点击选择某个单元格,然后再次点击此单元格,即可出现菜单。

也就是说,第一次点击是选择,第二次点击是显示菜单:

单单显示菜单是没有意义的,目的是通过菜单增加行,或编辑和删除选定的行,新增行好办,但是要实现编辑和删除行,就必须给服务器传递当前行的主键,这样服务器才能知道客户端需要编辑和删除的是哪一行,最好也将当前的页码一并传递给服务器,这样编辑和删除行之后,还能回到当前页,这是我们下一节要解决的问题。

 


本页地址:http://www.foxtable.com/mobilehelp/topics/0117.htm