• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Data not refreshing after updating

 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am working on B&S.
I booked the record and its updated in file but it not dislapay in JTable after reading file.

Can anyone know the solution

Thanks in advace

Vaishali
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was thinking about this too, and come to 2 solutions.
1. repeat the last search
2. if there was no error while calling book(), update the table "blindly"
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am also doing same things then also its not displaying updated record

Following is my code:

controller.update(recordNo,records);
tableHandle = controller.find(criteria);
addDataInTable();



Code in update method

ArrayConvertIntoString writeRecord = new ArrayConvertIntoString();
int i=0;
while(i<ContractorInfo.totalField){
writeRecord.write(data[i], ContractorInfo.lenghtOfField[i]);
i++;
}
synchronized (database) {
database.seek(ContractorInfo.offset
+ recordNo* ContractorInfo.totalLength
+ ContractorInfo.flagValue);
database.write(recordValue.toString().getBytes());
}

Anyone have any solustion for file refresh?

Thanks

Vaishali
[ August 28, 2007: Message edited by: Vaishali Paramane ]
 
Sagar Salapaka
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could it be as simple as not calling fireTableDataChanged() on the underlying table model?

Sagar
[ August 28, 2007: Message edited by: Sagar Salapaka ]
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sagar Salapaka:
Could it be as simple as not calling fireTableDataChanged() on the underlying table model?

Sagar

[ August 28, 2007: Message edited by: Sagar Salapaka ]


:-), looks like you are right,.. I didn't read the question carefully.
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sagar Salapaka:
Could it be as simple as not calling fireTableDataChanged() on the underlying table model?

Sagar

[ August 28, 2007: Message edited by: Sagar Salapaka ]


Hi sagar
thanks for replying. but I didnot get you what you means.
I didnot impliment fireTableDataChanged() method.

Please can you explain it.

again thanks

Vaishali
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yo don't have to, it's already implemented in AbstractTableModel. When you update your model, just call this method and view will redraw.

http://java.sun.com/javase/6/docs/api/javax/swing/table/AbstractTableModel.html#fireTableDataChanged()
[ August 28, 2007: Message edited by: John Stone ]
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
I fired fireTableDataChanged on my tableHadler class

public class TableHandle extends AbstractTableModel{
}

then also my JTable doesnot showing updated record.

Please can anyone help me.

Thanks

Vaishali
 
Jar Jaquiso
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Vaishali,

You may need to call repaint() on your JTable.

Jar
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should repaint after fireTableDataChanged() is called.
Are you creating more than one JTable? I remember, that one rancher had similiar problem, because he created more than one JTable and they were stacked one on another.

Are the Sun tutorials on JTable working ok?
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

My problem solved.

Actually its giving exception thats why behind the code doesn't working.

Thanks again for help

Vaishali
[ September 06, 2007: Message edited by: Vaishali Paramane ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic