Kasun Kanchana
Member
Hi, I need someones help for solve my problem. I'm developing an app which directly connect with remote MySQL database using JdbcSQL and display data using xCustomlistview.
In xcustomlistview 1 use 2 panel to show data as 2 columns (Like grid)
This is what its looks like in design view,
This is the code I've used to create the card,
And this is the code I've used to display data,
This will only add data to the panel 1. I want to add data to both panels. I cannot move into next row to get data and add them in same row in xcustomlistview. So how can I do that? in mysql library we can use "position" option. but in JdbcSQL there is no anything like that. I hope you guyz understand what I'm try to say. If anyone know how to solve this problem please let me know.
Thank you.
In xcustomlistview 1 use 2 panel to show data as 2 columns (Like grid)
This is what its looks like in design view,
This is the code I've used to create the card,
B4X:
Private Sub CreateItem(Width As Int, Title1 As String, Image1 As String, price1 As String,Title2 As String, Image2 As String,price2 As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
Dim height As Int = 180dip
If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
p.SetLayoutAnimated(0, 0, 0, Width, height)
p.LoadLayout("Card")
lbl_price1 .Text=price1
lbl_price2 .Text=price2
lbl_title1 .Text=Title1
lbl_title2 .Text=Title2
Return p
End Sub
And this is the code I've used to display data,
B4X:
ProgressDialogShow2("please wait..",False)
Dim SenderFilter As Object = connection.mysql.ExecQueryAsync("SQL", "SELECT * FROM products", Null)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As JdbcResultSet)
If Success Then
Log("success")
Do While rs.NextRow
clv.Add(CreateItem(clv.AsView.Width,rs.GetString("product_name"),Null,rs.GetString("price"),"title2",Null,"price2"),"")
Loop
rs.Close
ProgressDialogHide
Else
Log(LastException)
End If
This will only add data to the panel 1. I want to add data to both panels. I cannot move into next row to get data and add them in same row in xcustomlistview. So how can I do that? in mysql library we can use "position" option. but in JdbcSQL there is no anything like that. I hope you guyz understand what I'm try to say. If anyone know how to solve this problem please let me know.
Thank you.