Search code examples
apache-pivot

How to update data in bxml file based on resultset


I am new to apache pivot. I see there is limited examples for this. I need to know how to update data in the bxml file and make it visible in UI.

actually I am trying to create a table like structure from the result set of a query.

Thanks, Karthik


Solution

  • Typically you would display data from a query result set in either a TableView or a ListView component. In order to update the data that is displayed you could either set a new list for the component to display (using tableView.setTableData(...) or listView.setListData(...)) or simply add new data to the existing list.

    The bxml file can be used for providing static data (such as in some of the examples on the Apache Pivot site: http://pivot.apache.org/tutorials) but for dynamic data you would probably need to manage the data in code.

    For a TableView the list of data you supply would typically be a Pivot collections list of POJO / Java Bean objects, where the fields or properties of the object correspond to the names you supply to the TableView.Column objects your create. This is how it gets the data for each column in the table to display. You can also use HashMap or similar for the data, or a JSON structure.