B4J Question Tableview record display

oldeast

Active Member
Licensed User
Longtime User
Hi all,
I load a tableview and the items appear correctly, if I I filter the results the resulting records appear with a large space between them. The search looks at 16 columns but only two are displayed , so I set all the unused columns to not show, any help appreciated.
Thanks
Graham
upload_2016-11-23_18-3-53.png




B4X:
'load object tableview from user search term
    Dim strsearchstring As String
    Dim strItem As String
    Dim k, l As Int
    Dim lst As List
  
    lst.initialize
    lst.AddAll(cboSearch.Items)
    For k=1 To lst.Size-1 'dont add first item
    strItem=lst.Get(k)
    strsearchstring= strsearchstring & " " & strItem & " like '%" &txtSearch.Text &"%' OR "
    Next
    l=strsearchstring.length
    strsearchstring =Utils.Mid(strsearchstring,1,(l-3))
    Log (strsearchstring)
    strQuery = "SELECT * FROM Objects Where " & strsearchstring & "  Order BY Name;"
    End If
    'load object tableview
    DBUtils.ExecuteTableview(Main.SQL1,strQuery,Null,0,tblObjEdit)
    tblObjEdit.SetColumnVisible(0,False)
    tblObjEdit.SetColumnWidth(1,80)
    tblObjEdit.SetColumnWidth(2,200)
    For k=3 To lst.Size-1
    tblObjEdit.SetColumnVisible(k,False)
    Next

    End Sub
 

oldeast

Active Member
Licensed User
Longtime User
Looks strange. Maybe there are many empty lines in the results?
There are two records and the query is set to find both, when I reload the tableview to simply show both records, it reverts to a normal display.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
If you know the results will fit on a single line, you can force the cell height to a set value using setFixedCellSize

B4X:
DIm jo as JavaObject = tblObjEdit
jo.RunMethod("setFixedCellSize",array(24.0d))  ' 24 is the default height for cells
...
 
Upvote 0

oldeast

Active Member
Licensed User
Longtime User
G
If you know the results will fit on a single line, you can force the cell height to a set value using setFixedCellSize

B4X:
DIm jo as JavaObject = tblObjEdit
jo.RunMethod("setFixedCellSize",array(24.0d))  ' 24 is the default height for cells
...
Great thanks, I will use that.
 
Upvote 0
Top