Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

saving data to database without pressing button  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I've got a jTable which shows data from my sqlite database. There are 12 checkboxes above the jtable, which each represent a different set of data.
currently, if you select a checkbox and press load, the right set of data is loaded. if you press save the data is stored again in the database.

Now, would it be possible...to do the saving and loading without pressing the save and load buttons? If you just click on a checkbox the right set of data is loaded....and somehow saved if you change it.

my ideas so far:
- use an entry row. so all the data is stored if you enter an additional row, then the loading can be done with checking the checkboxes. However not really aesthetically pleasing.
- if a checkbox is selected, save the current data first, then load the new data. But there are loopholes here, when data does not get saved.

Could you give me some advice?
Thanks alot
Elwin

here is the code I'm currently using to save and load (from the GUI Panel).

Saving:


Loading:
 
elwin Ilam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured something out.

Data is saved when table loses focus,
Data is loaded when checkboxes are statechanged.

It seems to work pretty good.
Only when the Cell editor is still on, things go wrong.
But we'll see about that after the weekend (:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!