BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting and unsorting

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Guillem
Guest





PostPosted: Tue Feb 15, 2005 12:45 pm    Post subject: Sorting and unsorting Reply with quote



Hi,

I've got a TDBGrid which shows the data from a TADOdataset. I also have
added an OnTitleClick event handler to allow the user to sort by whatever
field he wants, and a Tcheckbox for enabling/disabling the usage of the
OnTitleClick event. It works fine but i have 2 questions:

1- If I have the data sorted (for any field) and I insert a new record, it
is immediately ordered. This is ok, but if I have a lot of records the user
does not know where the record actually is, and could have the impression
the data is gone. So I would like to have the last record inserted focused
but I'm not sure how to do this. Any idea?

2- If I sort by any column and then disable the ordering by column i would
like the records to stay "ordered" as they are at that moment, and if I
insert a new record that it also stays at the position where I insert it.
Problem is if I put the Sort property to '' then the dataset is
automatically "ordered" as it was when the data was loaded for the first
time, and if I do not touch the Sort property it still sorts. Is it possible
to do what i want?

--
Thanks in advance for help & best regards :)

Guillem Vicens
Dep. informática Green Service SA
[email]guillemvicens (AT) clubgreenoasis (DOT) com[/email]
www.clubgreenoasis.com


Back to top
Guillem
Guest





PostPosted: Wed Feb 16, 2005 10:15 am    Post subject: Re: Sorting and unsorting Reply with quote




"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> escribió en el mensaje
news:k9e5111bkb75areb1g0evt6397utmr1m68 (AT) 4ax (DOT) com...
Quote:

1- If I have the data sorted (for any field) and I insert a new record, it
is immediately ordered. This is ok, but if I have a lot of records the
user
does not know where the record actually is, and could have the impression
the data is gone. So I would like to have the last record inserted focused
but I'm not sure how to do this. Any idea?
The behavior I see is for the cursor to stay with the cursor when a record
posts. Can you describe the circumstances under which you loose the
posted
record"


Actually, I'm not posting the record to the database immediately. The client
works on a snapshot of it, and when he decides to either accept the changes
and leave, or save the changes they are posted. Doing further tests i have
seen that it actually focuses the next record considering the order
established (if i insert a record which would be in position 2 it focuses
position 3). This is not really so bad, but i would like the cursor to stay
on the last inserted (in example before position 2).

I was thinking about using the RecNo property for it, but I'm not sure how
to do it. Any help would be appreciated

--
Best regards :)

Guillem Vicens
Dep. informática Green Service SA
[email]guillemvicens (AT) clubgreenoasis (DOT) com[/email]
www.clubgreenoasis.com



Back to top
Guillem
Guest





PostPosted: Wed Feb 16, 2005 4:05 pm    Post subject: Re: Sorting and unsorting Reply with quote




"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> escribió en el mensaje
news:k9e5111bkb75areb1g0evt6397utmr1m68 (AT) 4ax (DOT) com...
Quote:

1- If I have the data sorted (for any field) and I insert a new record, it
is immediately ordered. This is ok, but if I have a lot of records the
user
does not know where the record actually is, and could have the impression
the data is gone. So I would like to have the last record inserted focused
but I'm not sure how to do this. Any idea?
The behavior I see is for the cursor to stay with the cursor when a record
posts. Can you describe the circumstances under which you loose the
posted
record"


Actually, I'm not posting the record to the database immediately. The client
works on a snapshot of it, and when he decides to either accept the changes
and leave, or save the changes they are posted. Doing further tests i have
seen that it actually focuses the next record considering the order
established (if i insert a record which would be in position 2 it focuses
position 3). This is not really so bad, but i would like the cursor to stay
on the last inserted (in example before, position 2).

I was thinking about using the RecNo property for it, but I'm not sure how
to do it. Any help would be appreciated

--
Best regards :)

Guillem Vicens
Dep. informática Green Service SA
[email]guillemvicens (AT) clubgreenoasis (DOT) com[/email]
www.clubgreenoasis.com



Back to top
Guillem
Guest





PostPosted: Thu Feb 17, 2005 3:10 pm    Post subject: Re: Sorting and unsorting Reply with quote

Hi,

well, somehow it's fixed now. I have no idea what it was because i was
changing something else. Anyway, thanks for your help Brian
--
Best regards :)

Guillem Vicens
Dep. informática Green Service SA
[email]guillemvicens (AT) clubgreenoasis (DOT) com[/email]
www.clubgreenoasis.com


"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> escribió en el mensaje
news:4u18111ogo9epr9v4fta8h9shp354kdjun (AT) 4ax (DOT) com...
Quote:

Actually, I'm not posting the record to the database immediately. The
client
works on a snapshot of it, and when he decides to either accept the
changes
and leave, or save the changes they are posted. Doing further tests i have
seen that it actually focuses the next record considering the order
established (if i insert a record which would be in position 2 it focuses
position 3). This is not really so bad, but i would like the cursor to
stay
on the last inserted (in example before position 2).
I can't reproduce the next record behavior.

--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.