B4J Question How to display b4xtable in the showdialog window, or how to display the content of b4xtable as a list in the showdialog window?

guandjy

Member
B4X:
Private Sub Button2_Click
    Dim RowId As Long = GetRowId(Sender)
    Dim Item As Map = B4XTable1.GetRow(RowId)
    Dim RowData1 As Map = B4XTable1.GetRow(GetRowId(Sender))'获得
    Dim cell1 As String = RowData1.Get("m1")
    PrefDialog.Initialize(Root,"ziduan":" & cell1,600dip,300dip)'
            Dim RowData As Map = B4XTable1.GetRow(RowId)'获得预算编号
            Dim cell As String = RowData.Get("预算编号")
            Dim req As DBRequestManager = CreateRequest
            Dim cmd As DBCommand = CreateCommand("select_zhixingmingxi",Array(cell))
            Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
            If j.Success Then
                req1.HandleJobAsync(j, "req")
                Wait For (req) req_Result(res As DBResult)
                req.PrintTable(res)
                For Each row() As Object In res.Rows
                    Dim val1 As String = row(res.Columns.Get("riqi"))
                    Dim val2 As String = row(res.Columns.Get("yewu"))
                    
                    xui.MsgboxAsync(val1,"")                   
                   Panel = xui.CreatePanel("")
                   Panel.SetLayoutAnimated(0, 0, 0, 300dip, 300dip)
                   Panel.LoadLayout("ListTemplate") 'ListTemplate is part of XUI Views library.
                   CustomListView1.sv.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0)
                   Dim Item1 As B4XView = xui.CreatePanel("")
                   Item1.SetLayoutAnimated(0, 0, 0, Panel.Width, 50dip)
                   CustomListView1.Add(Item1, Array(val1,val2))
                  
                Next

                
            Else
                Log("ERROR (7): " & j.ErrorMessage)
                
            End If
            j.Release
        End If
    ShowDialog(Item, RowId)
    
Private Sub ShowDialog(Item As Map, RowId As Long)'弹出对话框
    
    Wait For (PrefDialog.ShowDialog(Item, "确定", "")) Complete (Result As Int)
 
    
    End If
    
End Sub
1.png
 
Top