Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Adding new row to GridCtrl... How to force a resort?
Adding new row to GridCtrl... How to force a resort? [message #23373] Wed, 14 October 2009 14:08 Go to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
My grid control is user sortable. The grid control just displays a small summary of the actual records data. There is an Add button on my form. When the user presses the Add button a complex dialog appears to allow them to enter the data needed. They then click save. At that, I add the new row to the GridCtrl but at this point I would like it to not appear at the bottom but in the correct location based on the current sort order.

I looked through the methods, I was hoping for something like .Resort() but did not find it. I do see .Sort() but I am unsure of how to get the current multisort order and direction (i.e. column 1 is UP, column 2 is DOWN and column 5 is UP... who knows what the user will actually do, that was just an example).

Any help is appreciated!

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23376 is a reply to message #23373] Wed, 14 October 2009 21:11 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Try latest svn. I've added ReSort().
Re: Adding new row to GridCtrl... How to force a resort? [message #23383 is a reply to message #23376] Thu, 15 October 2009 19:02 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Ok, this is done and ReSort() now exists. However, it does not seem to be paying attention to the actual sort order as specified by the user at the time ReSort() is called. For example, I have:

[ Date ] [ Name ] [ Number ]
----------------------------
10/12/09 Jim Doe  3.4
10/10/09 John Doe 12.5
05/18/07 Jeff Doe 5.0


The current sort order is Date Descending. When I edit "John Doe" and change the date to "10/18/09" and call ReSort() I get:

[ Date ] [ Name ] [ Number ]
----------------------------
05/18/07 Jeff Doe 5.0
10/12/09 Jim Doe  3.4
10/18/09 John Doe 12.5


Now, to make matters worse when sorting by Number, changing John Doe from 12.5 to 0.1, then calling .ReSort(), it resorts according to Date Ascending order, not Number which is what I had selected at the time.

My setup code for the grid sets initially:

log.Sort(FLIGHT_DATE);


So, it seems to always be reverting to that not what the user may have changed it to.

Any ideas?

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23386 is a reply to message #23383] Thu, 15 October 2009 22:37 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Ok. I think I have this fixed now. I'll commit this fix tomorrow.
Re: Adding new row to GridCtrl... How to force a resort? [message #23387 is a reply to message #23386] Thu, 15 October 2009 22:39 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Thanks.

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23410 is a reply to message #23386] Sat, 17 October 2009 15:02 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
unodgs wrote on Thu, 15 October 2009 16:37

Ok. I think I have this fixed now. I'll commit this fix tomorrow.


Any luck on this?

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23411 is a reply to message #23410] Sat, 17 October 2009 22:33 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

Sorry for delay. It's in svn now. Please try.
Re: Adding new row to GridCtrl... How to force a resort? [message #23413 is a reply to message #23411] Sat, 17 October 2009 22:44 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
unodgs wrote on Sat, 17 October 2009 16:33

Sorry for delay. It's in svn now. Please try.


No problem... waiting for SVN repos to sync up :-/ Why can the main repo not be shared as read only?

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23415 is a reply to message #23411] Sat, 17 October 2009 23:25 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
unodgs wrote on Sat, 17 October 2009 16:33

Sorry for delay. It's in svn now. Please try.


ReSort seems to work just fine now. The searching and Summary also *almost* works. It does on the DoSum, DoMin and DoMax but the DoCount summary still shows the total count not the count of items found when searching.

Thank you very much for these fixes!

Now, I don't want to sound like I'm nit picking because I *really* enjoy GridCtrl! It's the best control of it's type that I've ever used. I do have a simple complaint related to searching and the summary data.

When you type in the search box or when the grid has focus it begins a search, which is fantastic. However, the Red background and yellow text seems to be redundant and it covers parts of the summary bar (or data if the summary bar is not present). The text you type is also inserted into the Search Widget.

Why have both and cover up valuable data?

Jeremy
Re: Adding new row to GridCtrl... How to force a resort? [message #23417 is a reply to message #23415] Sun, 18 October 2009 10:10 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

DoCount is fixed now. As for searching you're right it's unnecessary to display search string twice. Just turn it off Wink
grid.SearchDisplay(false);

PS: It's good you're complaining about gridctrl Smile It means less bugs for all of us.
Re: Adding new row to GridCtrl... How to force a resort? [message #23419 is a reply to message #23417] Sun, 18 October 2009 12:37 Go to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Great! DoCount() does work fine now and I also got rid of the extra search text. I wonder if that should be off by default?

Jeremy
Previous Topic: Doing my own thing with the ADD button on GridCtrl?
Next Topic: Arrayctrl and scroll lines
Goto Forum:
  


Current Time: Fri Mar 29 15:49:52 CET 2024

Total time taken to generate the page: 0.01568 seconds