Figuring out datagrid sort programmatically

OK I've got a datagrid with 4 columns. I'm giving the end
user the opportunity to sort on any of these columns. They also
have a report that is generated based on the data in the grid, but
I'm wondering how determine on which column the grid is sorted, and
which (ascending / descending) order so that I can sort the report
in that exact same manner.
I've added some code on the headerRelease event to track this
information (storing it in the Cairngorm ModelLocator), but if you
trace the results it doesn't foot to what you're actually doing,
for example the following writes inconsistent (to the apparent
action being taken in the interface) info to the console. I can
always get the correct dataField property, but its sortDescending
property is almost always opposite of what the datagrid displays:
private function
handleHeaderRelease(dgEvent:DataGridEvent):void
for(var k:int=0;k<myGrid.columns.length;k++)
trace(myGrid.columns[k].dataField + ":" +
myGrid.columns[k].sortDescending);
trace("");
Does anyone know of a better way to figure out on which
column the grid is currently sorted, and what sort nature is
currently applied?
TIA,
Joe

OK I figured this out after remembering that the dataprovider
of the datagrid is just an ArrayCollection - here's the answer for
anyone who's looking for the same thing.
In the function that calls the report:
var s:Sort;
var sF:SortField;
s = summaryGrid.dataProvider.sort;
// if sort is null, they haven't clicked any column headers,
so use the default
if(s == null)
urlVariables.sortOrder = "dtAdded";
urlVariables.sortNature = "DESC";
otherwise use the first sort field
(this could be modified to build an appropriate order by
statement for multiple
sort fields if necessary)
else
sF = s.fields[0];
urlVariables.sortOrder = sF.name;
urlVariables.sortNature = sF.descending?"DESC":"ASC";
Hope this helps someone!

Similar Messages

  • AppleScript - figured out a way to make it wait (sort of).. advice?

    i've been trying to write an applescript that acts sort of as a printing helper in sketchup (getting accurate prints from sketchup is way too confusing and actually impossible to really get it right)
    anyway, things were moving along nicely until i hit a brick wall as far as how i'd like the script to work..
    it came to a point where i needed the script to wait for the user to close a dialog in order to stop updating the variables is was getting..
    all my searches and everything i've read so far has said you can't do it in a single script but i might of figured out a way..
    here's the part i'm talking about: (the example uses textedit since i figure everyone has it and it uses the same print dialog as sketchup)
    tell application "TextEdit"
      activate
              tell application "System Events" to tell process "TextEdit"
      -- so i can get just the numbers from static text a little further down
                        set AppleScript's text item delimiters to {" "}
      -- probably a better way to talk to TextEdit than this?
      -- for sake of example, i'm doing it the same way as with sketchup
                        click menu item "Page Setup…" of menu 1 of menu bar item "File" of menu bar 1
      -- this is the part that will wait until the user clicks 'ok' in the
      -- 'page setup…' dialog.
      --the user can continue to change their paper size and the script will wait until they make a final selection.
      -- it's actually pulling the numbers from bit of text underneath the 'paper
      -- size' popup.. when the user changes the paper size, that bit of text updates
      -- and so do the script's variables..
                        repeat until focused of text area 1 of scroll area 1 of window 1 = true
                                  try
                                            set psz to value of static text 2 of sheet 1 of window 1
                                  end try
                        end repeat
      -- in my script, i also check for the paper orientation but it's not
      -- relevant for this thread..
                        set papw to first text item of psz
                        set paph to third text item of psz
      --not part of my script.. just an example of the numbers i want.
                        display dialog "width = " & papw & "
    height = " & paph
              end tell
    end tell
    i have had it fail a couple of times but in most cases, it makes it though.. i'll experiment a little more with it to try to stop those errors..
    i guess my question is -- why hasn't anyone done this before? (just kidding, they probably have but i couldn't find it online)
    or my actual question is -- is there anything inherantly wrong with this approach.. i mean, if i can get it to make it through consistently, is there a problem with it repeating / updating the variable so many times in a row? is it a drain on system resources or can it break anything etc.?
    thanks

    or my actual question is -- is there anything inherantly wrong with this approach.. i mean, if i can get it to make it through consistently, is there a problem with it repeating / updating the variable so many times in a row? is it a drain on system resources or can it break anything etc.?
    Although I'm far from being an expert in programming, I would answer NO. Imho, you've just got a brillant idea! (As for “repeating / updating the variable so many times in a row”… you could add a short delay (like “delay 1”) inside the repeat block, but I don't think it's a must.)

  • IPhoto:  How can I sort photos within an event?  I can't figure out how to activate the Manual Sort.

    iPhoto:  How can I sort photos within an event.  I can't figure out how to activate the Manual Sort button.

    Only albums can be sorted manually. Events can only be sorted automatically according to one of the predefined settings "Date, Keywords, Title, Rating".
    If you need a manual sort order, selectaall photos in the event and create an album: File > New Album

  • Help! I figured out the problem - sort of.

    So I posted my problem two days ago. I found that only some of my pages were loading in Firefox 3. I didn't know why (see below for original posting).
    With a little experimenting, I have found that republishing the pages that "work" actually causes them to no longer work. I'm pretty sure I published these pages that worked with previous versions of iWeb. Now that I'm using the latest version of iWeb, any new pages (blogs) cannot be viewed by Firefox 3.
    Is there anyone out there with a work around? Solution? Anyone?
    HERE IS THE ORIGINAL POST:
    HELP- Take a look at my pages- What's wrong?
    Posted: Nov 19, 2008 3:19 PM
    Reply Email
    Here are links to my pages: the first link doesn't load in Firefox 3. The second link loads fine. I can't figure out the difference between the two pages. Any web gurus out there that can determine my problem? I really want people using firefox to be able to view my site.
    THANKS!!
    LINK 1:
    http://web.me.com/reeldamian/DAMIANDP.COMNYO/COMMERCIAL_REEL/COMMERCIALREEL.html
    LINK 2:
    http://web.me.com/reeldamian/DAMIANDP.COM_NYO/FX/FX.html
    Message was edited by: 3pointer

    I installed oracle apps 11.5.10.2 using steps given in thread and I didnt have any problems. I then installed it on my friends laptop and it worked fine. but recenly it stopped working in my laptop, i was not able to open login page from main url (http://www.msb.ora:8000) it gave error : page cannot be found
    So i reinstalled it on fresh system again.. but since then it not working. I have tried atleast 9-10 times and everytime it ends up with same error "jsp is not responding", I am able to open the rapid install main page but I am not able to open login page. it says page cannot be found. i followed all the steps suggested by you guys in this thread to solve this error, but still have no luck.
    I have tried following steps to solve the issue
    1) As its recommended to installed apps on fressh os without jdk i did the same, as i didnt worked i tried installation with jdk preinstalled,
    2) i have tried on both windows server 2003 and win xp professional
    3) I tried to change the jdk path in jser.properties file
    I will really appriciate any help to solve this problem. Below is system details:
    os: windows server 2003
    ram : 1gb
    processor: 1.83ghz core 2 duo
    Oracle apps 11.5.10.2
    java version: 1.4.2_04 ( installed by rapidwiz)

  • Figuring out windows system utilization - Programmatic Interface to Perfmon/Resmon

    Hello:
    Is there a mechanism to figure out that a system is utilized for a given period of time without constantly monitoring it(like installing an agent and constantly running it)? is there a certain set of metrics that are natively captured by windows, that I
    can query using WMI/ Powershell?
    any kind of refrences will be helpful
    Thanks!!

    Sure; Performance counters can do that: https://msdn.microsoft.com/en-us/library/windows/desktop/aa373083%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396.
    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

  • Trying to scan photos from my photo album to a folder on my desktop.  Have been trying to figure out for over an hour.  Seems very complicated and cumbersome,  Can you help?

    Trying to scan photos from my photo album to a folder on my desktop.  Have been trying to figure out for hours.  Seems very complicated and cumbersome.  Can anyone help?  It's got to be much quicker (fewer key strokes) and simpler than what I've been able to discover.

    Open the file, parse it, populate an ArrayCollection or XMLListCollection, and make the collection the DataGrid dataProvider:
    http://livedocs.adobe.com/flex/3/html/help.html?content=Filesystem_08.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=12_Using_Regular_Expressions_01.ht ml
    http://livedocs.adobe.com/flex/3/html/help.html?content=dpcontrols_6.html
    http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html
    http://livedocs.adobe.com/flex/3/langref/mx/collections/XMLListCollection.html
    If this post answered your question or helped, please mark it as such.

  • I am using numbers in the new iWork. Just bought it 10 days back. I am not able to figure out how to add serial umbers from 1 to 100( for example) also i need to freeze the top header like in windows so that we can browse down without the heading going of

    i am using numbers in the new iWork. Just bought it 10 days back. I am not able to figure out how to add serial umbers from 1 to 100( for example) also i need to freeze the top header like in windows so that we can browse down without the heading going off. Can some one help?

    Hi Jay,
    Be aware that "Freeze Header Rows" and "Freeze Header Columns" apply only to rows and columns that are Header rows or Header columns. You can have up to five Header rows, Five Header Columns (and five Footer rows) on a Numbers Table.
    "Header rows" is a special designation. Besides being able to be frozen, Header and Footer rows are not included in formulas referencing whole columns, making it possible to place formulas such as =SUM(B) at the top (or bottom) of column B without causing a self-reference error, These designated rows are also not included in sorts of the rows in a table.
    Regards,
    Barry

  • Don't know what I did, but now can only view my mail as a list ... have to open each email individually... Help! lol  just want to return to the normal window configuration, but can't figure out how to do that!

    I don't know what I did when I was checking my emails, but somehow I ended up with a large window that displays a list of the emails but not the content of the selected one like before, unless I open each one individually... I tried shutting down, hoping that the email app would restore through some default setting, but it came back the same way... It's probably something simple, but I watched all the tutorials I could find, and there isn't any mention of how to configure the email window.
    I played around with the toolbar, trying to figure out how to restore the original window, but nothing worked. I can sort things in many ways that I couldn't care less about! I just want the old setting back that shows the window where the upper half is the latest emails and the bottom half is the opened email that is high- lighted.  Help!

    Thank you, so much, Stedman!  I feel like an idiot, but I never ran into this before! I'm new out here (relatively) and sometimes the simplest things seem to ambush me!! lol  Thanks for taking the time to help me out!
    You saved my life tonight!  lol  More or less!  Tony<3

  • Help!  -Can't figure out how to Reinstall OS X on my iMac!!

    Hello all,
    Had a quick question that I can't seem to find a proper answer to..
    I'm wanting to place my OS X Install Discs on my External HD as backups.
    Turns out I have another computer (iMac Tangerine) that does not have a DVD-ROM drive, just an OLD CD-ROM drive (that doesn't even support CD-R incidentally - so that's out)...
    Sort of stumped. My best guess is that maybe if I move the OS X Discs onto my External Hard Drive - using my MacBook - I can then plug the Ex. HD into the iMac (has firewire) and perform the much-needed OS X Reinstall....
    Tools:
    MacBook
    LaCie 150GB External HD
    iMac - fried OS, no System Pref. No Disk Utility, won't accept online apps I've tried to download etc. etc..
    Need to kill the whole thing off - and reinstall everything on the iMac.
    Please help.
    Thanks very much in advance...
    [email protected]

    Thanks for the input Roam. This may be the toughest situation you've heard of - because -I actually tried what you're suggesting - it was the first thing I did in fact.
    I do not have the OS reinstall discs on CD; only DVD.
    I DO however have the original OS 9.2 Discs. But they will not load using the "hold down C and restart" thing either.. It simply does not recognize the command, due to the fact that there are so many Apps/Utilities that have been lost on the OS 10.3.9...
    Even worse - Applications and Utilities such as System Preferences, Installer, Disk Utility etc. have been deleted/destroyed...
    In addition, the iMac will not recognize the Target Drive option either when I try to connect it to my MacBook with a FireWire...
    The one thing that does work with it - is my External Hard Drive..... But I can't figure out how to get the OS X DVD onto the External HD in order to utilize that possibility..
    I can't figure out a reasonable way to get anything done whatsoever... It's just frozen. I've been at a loss for 2 weeks now. Racking my noggin..
    I wish there were a big red RESET button that I could press..
    Essentially that's what needs to happen.

  • Trying to figure out how to free up more memory on my macbook pro

    Hello. My name is Seth. I recently started to notice that my RAM when I start up my macbook pro starts at about 3 GB. I wasn't sure if this was a normal number or if there is any way I can free up a little bit more somehow. I got my mac in Novmeber 2010. I have 4GB of DDR3. The version is 10.6.8. If there is anything anyone can tell me to help, please do. If there is any more information you need from me that I forgot to put in this post, tel me and I will reply as quickly as I can. Thank you very much, and I appreciate any help!
    -Seth

    Well, first, Thomas, that was a very gracious reply. Nice to see that kind of thing on forums, as too many any more are just plain caustic. Shows what basic anonymity does to some people, huh.  And actually, such causticness is probably more along the lines of a pendulum swing *away* from the also too-prevalent "political correctness" that, well, weinies need to use. Methinks that perhaps all of America, perhaps all of the world, is becoming pathologically bipolar. LOL   So anyway, wanna say that you sound like a real decent guy. Must be a Mac guy. hehe
    Secondly, my reasons for submitting what I thought were helpful alternatives to looking at spinning beach balls while your fingernails waiting on the keyboard grow another half inch comes from my experiences. I'd like to elucidate.... When I got back into Macs in '06 after 18 yrs on The Dark Side, & 2 or 3 yrs with Macs, professionally, prior to that, I re-started with a PowerBook then. 1GB RAM, max. Lame, even then. And then a MacBook1,1 @1.83. Very first all-white one. 2GB max. Lame. Trouble, trouble. Frustratingly so. And now, I've got a 7,1 @2.4. Very last all-white one Apple made. I like the all-white ones. 2Gigs again, but that I bumped up to its 8Gig max. And STILL I have RAM jams. Not as frequently of course, but they happen. And what I run into *most* often, is the system NOT automagically releasing Inactive RAM. Just sits there. And if I've got FF or something that leaks memory running, & I myself crash & sleep, I wake up to completely or nearly so solidly wired-up RAM. Which means it's power button for 5 seconds time. & then Applejack at reboot to fix stuff that got hosed.   Doesn't happen often, but enough to make me go search for solutions when I shouldn't be having any with the above-average 8Gigs of RAM.
    So one day I discovered the Purge command. And using that has kept the aforementioned scenarios from deteriorating to the aggravating point when not even the beach ball comes up, nor of course anything else. 
    And so I use it. Use it a LOT when I've got open apps' icons spread from one side of my screen to the other, especially Win7 in VMWare when I've got a bunch of Mac stuff open, too. And I have read NOwhere, except what you have written, that there is any "harm" to purging at all. Hasn't caused me any probs, I know that. Only good stuff. I *would* like to know about any possible problems that, as you stated, purging could cause, as published by a Mac magazine or respected tech site. So if you can steer me & others who read this & are curious about the subject to any current articles about that, I would like to take a look-see & learn. But what I'm going by is what has proven to work, for me, & I am pretty certain that at least all Intel machines running 10.6+ work in pretty much the same way too, so....  That's why I posted. Just sharing my experiences, a screenshot, and the simple little script app I made in less than a minute. And I admit, yeah, the XCode DL is pretty darn big. But ya don't have to install everything. Just what's needed, & then you can dump the Receipt file if ya want, or save it to an external something or other.
    But not wanting to be a butt here, I will do some research about the use of purge, because you stated that 'true power users' understand when its use is apt, & when it's needed & so forth. Well, I *know* when it's needed in my experiences, & it does the job, without repercussions of any kind. But I'll look into it, willing to learn & throw away old ideas if appropriate.
    Thirdly, RE: Novice users taking my advice:
    Stupid is as stupid does, Thomas. You know that. I know I've been through that during my occasionally steeper learning curves, maybe you as well. That's how I learned stuff, particularly DOS/Windows, which just screams gimmee your attention anyway. So what I'm saying is that I find it loathsome to think that I or anyone would have to babysit the reckless ones. Who are they? Must I assume that ANYONE & EVERYONE fits that category, & so submit pablum & half-baked mostly useless mediocre BS smoke?  nyu uh. not me. I have enough respect, you might say, for people to give them the benefit of the doubt that they'll choose wisely. And those who don't, well, Darwin's Law steps in. Been there too, done that too. I consider submitting diluted blabla just so disgustingly pompous, really. Sayin' something, but then you're not, too. Self-serving junk, in other words.
    So...... done now.  Thanks for the tips, Thomas, & the advice, & I'll heed ya some but I can't think of readers of these forums as babies who need to be coddled. Mistakes made are learning experiences.  The most important learning being, of course, is when to gamble on possible learning, & when not to. That's the beginning of not making stupid-a** mistakes. And some want to learn that 'hard way' either by choice or, yeah, with intelligence-backed recklessness, & some wouldn't dream of learning that way on their machine. Scares 'em. They don't know that you can *always* click on the 'cancel' button, yaknow?  When in doubt, gamble or get out.  But don't straddle.
    I'm counting on folks having enough brains between their ears to figure out what's doable for them at their skill/knowledge level when they read about tech procedures, & what's not. And what's got the pretty good odds of coming out in their favor, should they take a plunge of some technical sort. And that's learning, too. Probably the best kind, actually. Which couldn't happen unless somebody "pushes the envelope" (apparently) & submits some obscure tech procedures. What I proposed isn't super-techy by any stretch of the imagination in those who know. Not saying my stuff's all that, but I will say that Jobs knew all about that sort of edginess, which hoisted only red flags in some people's minds of course, the mediocrity lovers' minds that is. And I am pretty much like-minded with Jobs' ways in that respect. And I abhor the 'hypersafe,' banal ways of doing things. That ain't different. That's crap. hehe  ok. nuff said. out.....
    Have a good Sunday, Thomas.
    And thanks again for your gracious good-attitude reply to me.
    adios......
    KK

  • My iPhone 4S is not showing up in iTunes.  I've never had this issue before, but I'm finding it a little frustrating trying to figure out how to rectify the situation.  Any suggestions would be greatly appreciated.

    My iPhone 4S is not showing up in iTunes.  I've never had this issue before, and I'm finding it a little frustrating trying to figure out how to rectify the situation.  If anyone knows how to fix this problem, please advise.  Otherwise any suggestions would be greatly appreciated.

    Hi Josie,
    I understand that you are having issues with iTunes recognizing your iPhone 4S. Let's see if we can tackle this.
    The following resource will provide helpful steps in resolving this issue, pay specific attention to Steps 3-6 as these usually resolve this sort of issue.
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    Thanks,
    Matt M.

  • Background program running and can't figure out what it is...

    I have an IMAC desktop, I just purchased the Photoshop Elements 10 software for MAC, installed it, running fine. But now I have program that is contanstly running in the background that is slowing up all of my other applications I run while I'm working. I've checked the Activity Monitor but I can't see anything out of the norm...Does anyone have any suggestions? I'm very frustrated....

    I presume you mean that the hard drive is working on something. Again, any such process would show in the Activity Monitor. Check that again, confirming that you have "all processes" set so you can see everthing that's going on. It will be easiest to spot anything unusual if you click on the "% CPU" column header to sort by the amount of CPU time each process is using. Click twice so that the arrow is pointing downwards; then the top users of CPU time will be listed at the top. Post the name of any process that's consistently or unexpectedly using a significant amount of CPU time and we can probably figure out what's happening and offer suggestions.
    Regards.

  • How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How can I figure out where are the heaviest volumes in order to get rid of the useless stuff?.

    How about a few specific NOUNs to replace the vague references you have made. A little context.
    Volumes of WHAT ?
    What sort of STUFF are you trying to eliminate ?

  • Has anyone figured out a way to watch HBOGO, with iPad2 to HDMI TV?

    Has anyone figured out a way to watch HBOGO, with iPad2 to HDMI TV?, &amp; actually get more than the HBOGO SPLASHSCREEN &amp; audio? I am visually handicapped, &amp; would like to see Deadwood &amp; Enterage episodes on bigger screen..Thank you in advance! Jules

    Whoever told you Elements 3 won't work in Leopard was simply wrong. It does. Elements 2 and Photoshop 7 will not work, Elements 3 and Photoshop CS1 will both work. My understanding is that the code for both the non-working ones was a kludge of the original code built for the Classic Mac OS to get it to run natively in OS X, and, since Leopard no longer supports Classic code in any way neither PS 7 nor Elements 2 will work, ever. Don't know whether that theory about the code is correct or not, but it sounds sorta reasonable. But whether that is the explanation is irrelevant: Elements 2 and PS 7 do not work in Leopard.
    Why not do what I'm going to do: get off Adobe's gravy train. I'm going to buy Elements 6 when it comes out (which is about half what it costs to upgrade my CS1 to CS3), and spend some more quality time with the GIMP. No more upgrades of Photoshop for me.
    Francine
    Francine
    Schwieder

  • Digitizing Old Video Tapes I Can Figure Out Hardware is iMovie the Software

    I have some old VHS tapes and some newer DV tapes.
    I'd like to get convert all the old tapes so I can share digital copies with members of my family.
    I think I can hook up a VCR to my DV camera and then hook that to my iMac. Failing that I'll buy some sort of converter.
    Once I figure out the "hardware how?" I wonder about the "software what?" Is iMovie okay for me to work with? In what format do I store the files? bla bla bla. Right now I just want to get digital copies of all my videos; I'll edit files later.
    I only want to do this conversion once and would hate to end up with a lower quality compressed file or something not compatible with editing when if I'd set things different I'd be better off if you get my drift.
    I know there are many posts in these discussions about importing video -- if anyone can guide me through the advice or offer more insights I'd be grateful.
    Thanks

    I'd like to get convert all the old tapes so I can share digital copies
    I have done lots of that.
    I think I can hook up a VCR to my DV camera and then hook that to my iMac
    Yes, that is one way.
    Failing that I'll buy some sort of converter.
    I Like the Grassvalley ADVC300.
    I've played around with countless other conversion systems, ranging in price from $79 to $399. Short verison, this is the ONLY unit to own. No dropped frames at all, even with questionable quality tapes, no jitter, great color, excellent sound quality. Zero setup with iMovie 06 and iDVD 09/11.
    This is a prosumer deck. The time code function is alone worth the price if you have old analog footage. Absolutely NO "Out Of Sync" audio.
    ADVC300 is for anyone who wants to do editing and is concerned about quality of color and speed, for the novice it is an incredible gizmo that will restore VHS tapes to a state close to the original fixing midtones, highlights and shadows on the fly. Not only can you simply convert analog to digital you can actually manipulate the signal going in (if you want to).
    A bit pricey but it WORKS.
    I only want to do this conversion once and would hate to end up with a lower quality compressed file or something not compatible with editing when if I'd set things different I'd be better off if you get my drift.
    I do get your drift.
    I would use iMovie 06 with iDVD 09/11, why?
    iMovie 09/11 uses 'single field processing' meaning every other horizontal line of the video is thrown out, which reduces the sharpness of the footage. iMovie 06 uses ALL of the image to form the video.
    If your primary workflow is editing DV clips and making DVDs, iMovie '06 is better suited. Your movie will arrive at iDVD in DV format, which is an ideal match for making a DVD: same resolution, same pixels aspect ratio, and original quality. If you share your movie from iMovie 09/11, it gets re-rendered at 640x480 or less, and then iDVD upscales it back to 720x480. The end result is obviously not as good.
    Compared to today's standards DV Video's quality is not that great, so I don't want to lose ANYTHING in my conversion, I have no quality to "spare".
    iMovie 06 and iDVD 09/11 is a "lossless" combination.

Maybe you are looking for