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.

[389 byte] By [Suhas4Javaa] at [2007-11-26 15:06:12]
# 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.

-Grif-a at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 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.

Suhas4Javaa at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 3
Hi!You can enter value with setValue() function of DataProvider.Thanks,Roman.
-Grif-a at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 4
Hello.I've got the same problem.How exactly can I manipulate a table with the setValue() function?Thanks a lot,JessMessage was edited by: Fluxkompensator
Fluxkompensatora at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 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.

-Grif-a at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 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.......

Suhas4Javaa at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 7
Suhas4Java,can you show me a real working example?Thanks a lot
Fluxkompensatora at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...
# 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.
-Grif-a at 2007-7-8 8:56:07 > top of Java-index,Development Tools,Java Tools...