[mapguide-users] RE: How to sort a selection set

soudemans soudemans at ruekert-mielke.com
Fri Feb 3 14:12:56 EST 2012


Jackie,

 

Hey, thanks, I think I am making progress.  I am imagining that
SORT_PROPERTY is supposed to be the field name of the passed data, but
that does not work.  Can you clarify what I am supposed to use here, and
if it is the field name how I can get determine what it is?

 

From: Jackie Ng [via OSGeo.org]
[mailto:ml-node+s1560n4353253h69 at n6.nabble.com] 
Sent: Tuesday, January 31, 2012 8:21 AM
To: Oudemans, Sierk
Subject: RE: How to sort a selection set

 

The sorting function need not be that complicated. 

Something like this will suffice: 

results.sort(function(objA, objB) { 
   if (objA.SORT_PROPERTY < objB.SORT_PROPERTY) { 
       return -1; //Less than 
   } else if (objA.SORT_PROPERTY > objB.SORT_PROPERTY) { 
       return 1; //Greater than 
   } else { 
       return 0; //Equal 
   } 
}); 

Where SORT_PROPERTY is the name of the property of the object you want
to sort on. 

- Jackie 

________________________________

If you reply to this email, your message will be added to the discussion
below:

http://osgeo-org.1560.n6.nabble.com/How-to-sort-a-selection-set-tp434438
3p4353253.html 

To unsubscribe from How to sort a selection set, click here
<http://osgeo-org.1560.n6.nabble.com/template/NamlServlet.jtp?macro=unsu
bscribe_by_code&node=4344383&code=c291ZGVtYW5zQHJ1ZWtlcnQtbWllbGtlLmNvbX
w0MzQ0MzgzfC0xMzkyMzk3NTUy> .
NAML
<http://osgeo-org.1560.n6.nabble.com/template/NamlServlet.jtp?macro=macr
o_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespac
es.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.w
eb.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemai
l.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%
3Aemail.naml>  



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-sort-a-selection-set-tp4344383p4362835.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20120203/0664fb59/attachment.html


More information about the mapguide-users mailing list