Adding Data to Table component using defaultTableDataProvider
I am working with Visual Web Developer on netbeans5.5.
I have an issue with tables as most of the tutorials work with database drag and drop which is not possible with ms access database.
Hencei need to know of how to insert data into the rows. By using defaultTableDataProvider.....
If its possible also please suggest me of how to insert button in table.
# 1
Hi!
You can use set of data providers which are located in 'Data Providers' and 'Advanced Data Providers' section of palette.
Button in table You can insert in that way:
1) Rightclick on the table. Select 'Table Layout'.
2) Open 'Columns' tab and select needed column.
3) Choose needed component in 'Component Type' drop down list.
Thanks,
Roman.
# 2
Thanks a lot for the help
Well am actually stuck with including dynamic data to table, which i generate while runtime which is no where related to database.. i am not able to figure out the code to enter the values into the table.
Please help by giving a small code snippet for inserting values to table.
# 5
Hi!
As I know, defaultTableDataProvider extends ObjectArrayDataProvider and You can use it's function setValue(FieldKey fieldKey, RowKey rowKey, Object value).
Or just create new array with necessary data and then use function setArray(Object array[]) for set new data for table in full.
Thanks
Roman.
# 6
thanks a lot for the support...
now i can insert values into the existing table through
defaultTabeDataProvider.cursorFirst();
while(defaultTableDataProvider.cursorNext()){
defaultTableDataProvider.setValue(fieldkey,value);
}
method...
But i am not still not able to add or remove rows from that table....
when i execute
RowKey rk = defaultTableDataProvider.getCursorRow();
defaultTableDataProvider.removeRow(rk);
its suppose to delete the row.. But it is giving error : This row cannot be deleted- Unsupported Operation...
Please help me regarding this.......
# 8
Hi!As I know, defaultTableDataProvider doesn't support such functions as remove, insert, append row. It extends ObjectArrayDataProvider and if You need, You can override these function.Thanks,Roman.