Problem
How do I bind the WebDataSet class to a table component of the Form
Solution
To bind the WebDataSet class to a table component you need a DataSource. So first we create a DataSource based on Webdataset, then bind the component table to datasource.
Let's say I want to create the structure person, formed by the fields: First Name, Last Name and Birth Date, so:
First, create the structure with the WebDataSet class:
dataweb.util.treeset.WebDataSet wds = new dataweb.util.treeset.WebDataSet();
dataweb.util.treeset.WebDataSetSchema schema = wds.getSchema();
dataweb.util.treeset.WebDataSetSchemaColumn col = null;
col=schema.addColumn("FirstName", dataweb.util.treeset.WebDataSet.DATATYPE_CHAR, 50, 0);
col.setLabel("First Name");
col.setColumnWidth(150);
col=schema.addColumn("LastName", dataweb.util.treeset.WebDataSet.DATATYPE_CHAR, 50, 0);
col.setLabel("Last Name");
col.setColumnWidth(130);
col = schema.addColumn("BirthDay", dataweb.util.treeset.WebDataSet.DATATYPE_DATETIME, 00, 0);
col.setLabel("Birth Day");
col.setDataFormat("DateTime:dd/MM/yyyy");
Next, we create the DataSource based on WebDataSet:
dataweb.client.components.datasource.DSWebDataSet ds = null;
ds = new dataweb.client.components.datasource.DSWebDataSet(wds);
Finally we bind the component table to datasource
testTableComponent.setDataColumnNames("@All");
testTableComponent.setDataSource(ds);
