how can i join the tables and display the related column in datatable
posted 5 years ago
May i have your guide how can i join the tables and display the related column data in a datatable?
1) Table A consist column (Shelf,Food Type) and Table B consist columns (Food Type, Food Description).
2) In the .jsp, i have declared 2 datasource for both Table A and Table B and 1 datatable.
May i know how can i use the .addcolumn and .addjoin in the .java (the controller file for .jsp) in order to
join both of the tables and display data for TableA.shelf and followed by TableB.Food Description in the datatable i have declared in .jsp?
I viewed the .addcolumn function description :
0178: * This method adds a column to the DataStore using the datastore's default
0179: * table.
0181: * @param column
0182: * The name of the column to add to the datastore.
0183: * @param type
0184: * The type of the column to add to the datastore. This must be
0185: * one of the "TYPE" constants in the class.
0186: * @param primaryKey
0187: * True if the column is part of the primary key of the table it
0188: * is in.
0189: * @param updatable
0190: * True if this column should be updated when the update method
0191: * is called.
0192: * @see DataStore#setDefaultTable
0194: public void addColumn(String column, int type, boolean primaryKey, boolean updatable)
But, I don't understand what is the meaning of type of column...
I hardly find correct examples that shows how to apply .addjoin and .addcolumn.
Hereby hopes to have your guide on this.