[mapguide-users] Change order of fields displayed in properties pane?

von Wartburg, Jan BKSD Jan.vonWartburg at bl.ch
Wed Mar 27 00:13:11 PDT 2013


Hi Steve

You can achieve this by inserting a new function into ajaxmappane.templ:

function compare(a,b) {
  if (a.name < b.name)
     return -1;
  if (a.name > b.name)
    return 1;
  return 0;
}

Source for this function: http://stackoverflow.com/questions/1129216/sorting-objects-in-an-array-by-a-field-value-in-javascript

Then you can sort the feature values in the function OnSelectedFeatureChanged() just before the properties are being shown by SetProperties:

feat.values.sort(compare); //new line
GetPropertyCtrl().SetProperties(1, feat.values);


Tested only with MGOS 2.2.

Regards,
Jan

 

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Steve G
Sent: Tuesday, March 26, 2013 11:42 PM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] Change order of fields displayed in properties pane?

MGOS 2.4.0.7096
Maestro 5.0 b4 (Also tried 4.0.4)

I am finding that display order of the properties in the property pane in the Ajax viewer is restricted to alphabetical order of the property "Name". 
Changing the "Value" (in XML layer definition, or Display Name as identified in the current version of Maestro) does not appear to change the sort order as suggested above (I tried various methods to "re-shuffle" the properties including adding HTML tags, new Display names which 'should' have a different display order, none of which worked).  

In addition, when editing a layer definition in Maestro, I haven't found that putting properties in any particular order in the properties table (i.e. table showing which properties are visible) has any affect on the sort order.  

I tried to find the code section in the ajaxmappane.templ file which might pre-sort things (I believe the current code line is 3032), but that didn't seem to change anything.

I do have another server running MGOS 2.1 and it does support sorting alphabetically based on the "Value" field, so something must have changed in the last few versions. 

Any current alternatives?  I do want to be able to control the order in which properties are displayed.  I am surprised that others haven't reported this issue...seems like an enhancement candidate.

Steve G



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Change-order-of-fields-displayed-in-properties-pane-tp4185189p5043142.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list