craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > CellEditor/Renderer Post New Topic   Post A Reply
Commit changes when the selcted row is changed printer friendly version
next newest post | next oldest post
Author Messages
lhyna
Private

Gender: Female
Location: Colombia
Registered: Feb 2008
Status: Offline
Posts: 7

Click here to see the profile for lhyna Send email to lhyna Send private message to lhyna Find more posts by lhyna Edit or delete this message Reply w/Quote
Posted Wednesday, March 5, 2008 @ 10:59:06  

Hi!!! I'm trying to invoke an update to a DB when the row data has been modified, so I was thinking to commit it when the row selected is changed. i was looking at the examples, api or code if there is any way to do this, can u help me? till now i've been looking the method afterRowSelectionChange, but with no results. :(

--------------------
Lhyna

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, March 5, 2008 @ 12:22:26  

QuickTable automatically updates & commits database whenever the user moves away from the modified row. have you turned off autocommit. If yes, then in afterRowSelectionChange, you need to call commit.
lhyna
Private

Gender: Female
Location: Colombia
Registered: Feb 2008
Status: Offline
Posts: 7

Click here to see the profile for lhyna Send email to lhyna Send private message to lhyna Find more posts by lhyna Edit or delete this message Reply w/Quote
Posted Wednesday, March 5, 2008 @ 15:12:53  

Maybe i hadn't explain myself before (sorry)
The application I'm working at has a three tier architecture so i'm not using the functionalities of the grid to connect to the database, I'm just using the grid in the GUI tier. but i couldn't find an event that tells me when the selected row has been changed, in which I'm gonna introduce the code to commit in my db. could u please help me?
Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Wednesday, March 5, 2008 @ 22:38:01  

You have to use DatabaseChangeListener class.

Refer the following sample code
http://quicktable.org/discussion/cutecast/cutecast.pl?forum=14&thread=297

lhyna
Private

Gender: Female
Location: Colombia
Registered: Feb 2008
Status: Offline
Posts: 7

Click here to see the profile for lhyna Send email to lhyna Send private message to lhyna Find more posts by lhyna Edit or delete this message Reply w/Quote
Posted Thursday, March 6, 2008 @ 10:23:33  

Hi, yesterday I was like blocked, but today I made a few changes and it work perfect, here is the code if anyone want to commit changes when the selected row change.

class MyCellListener implements DBTableCellListener {

private quick.dbtable.DBTable tbl;
private MstrDlrListRWU update;
private int theRow;

public MyCellListener(quick.dbtable.DBTable tbla, MstrDlrListRWU upd) {
super();
this.tbl = tbla;
this.update = upd;
this.theRow=0;
}

public Object cellValueChanged(int row, int col, Object oldValue, Object newValue) {
if(this.theRow!=row){
System.out.println("update"+this.theRow);
this.theRow=row;
System.out.println("new row"+this.theRow);
}
return newValue;
}
}

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios