I am trying to learn how to use WebListBox control with the DataSource, I looked at available example in Xojo but I am still not quite sure how all this is supposed to work. I would like to ask for help.
I have web page called QueryPage with WebListBox control called ResultsList. The ResultsList control is supposed to get columns build dynamically at the time of running query against Postgres database. The query would normally return 50K+ rows. The query takes 1 parameter at this point for simplicity to be used with where clause. I use the timer to start method QueryPage.RunQuery. For this example to work I want to fetch 100 rows to begin with.
I have created class TableDataSource with the Interface option WebDataSource selected. I have looked at the Xojo example when setting methods in it.
Here is the QueryPage.RunQuery method:
ResultsList.DataSource = new TableDataSource
TableDataSource(ResultsList.DataSource).SetQuery (mCurrentQuery.query_text.getString,Param1Field.text)
Var DataRows() As WebListBoxRowData
DataRows = TableDataSource(ResultsList.DataSource).RowData(100,50,"")
ResultsList.ReloadData
I can compile and run this method, no errors. However, the ResultsList control is not showing any data. Obviously I don’t quite understand what I am doing. My intention is:
- Tell ResultsList that it should use DataSource
ResultsList.DataSource = new TableDataSource
- Pass Param1 to the TableDataSource with the query.
TableDataSource(ResultsList.DataSource).SetQuery (mCurrentQuery.query_text.getString,Param1Field.text)
- Set Limit and Offset for the query - I am not really sure if this is the right way to do so.
Var DataRows() As WebListBoxRowData
DataRows = TableDataSource(ResultsList.DataSource).RowData(100,50,"")
When this piece is run I see 0 to 99 WebListBoxRowData entries, the PrimaryKey is populated as expected, the Tag value is Nil
- Show data in the ResultsList
ResultsList.ReloadData
The above code doesn’t seem to do anything. In short I don’t see anything in the ResultsList.
What am I missing? What am I doing incorrectly?