Is there a way I can change which column values are visible on the client side?
Column Values visibility client side
Hi Taylor,
It’s hard to say, normally yes, can you detail your scenario?
Thanks,
Johnny
My web app is showing agriculture fields. Sometimes the user will want to see how many acres the field is, the name of the field, serial numbers, or any combination those values. I have a tree control sitting next to the map with checkboxes. I am using javascript to show or hide the individual layers like this:
function toggleVisibility(sender, eventArgs) {
var node = eventArgs.get_node();
var map = AcreageReportMap.GetOpenLayersMap();
var layer = map.getLayer(node.get_value())
layer.setVisibility(node.get_checked())
}
What is coming back as the variable 'layer' is actually a LayerOverlay. I have an InMemoryFeatureLayer in that overlay and I would like to be able to let the user choose which column values are visible using the tree and having it all happen without posting back. I'm not sure if I would have to rebuild the Default Text styles or if I would be able to do something simple like layer.something.DefaultTextStyle.ZoomLevel16.TextFormat = '[column1]-[column2]' This is how I am building the layer's style on load:
Private Sub setSelectionLayerStyle(ByRef shapeLayer As InMemoryFeatureLayer)
Dim font8 As New GeoFont("Arial", 8)
Dim font6 As New GeoFont("Arial", 6)
Dim blackBrush As New GeoSolidBrush(GeoColor.SimpleColors.Black)
Dim yellowBrush As New GeoSolidBrush(GeoColor.SimpleColors.LightYellow)
Dim styleText8 As New TextStyle(String.Format("[FSN]-[Tract]-[Field]"), font8, blackBrush)
Dim styleText6 As New TextStyle(String.Format("[FSN]-[Tract]-[Field]"), font6, blackBrush)
styleText8.OverlappingRule = LabelOverlappingRule.AllowOverlapping
styleText6.OverlappingRule = LabelOverlappingRule.AllowOverlapping
shapeLayer.ZoomLevelSet.ZoomLevel16.DefaultAreaStyle.FillSolidBrush = yellowBrush
shapeLayer.ZoomLevelSet.ZoomLevel16.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red
shapeLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = styleText8
shapeLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
shapeLayer.ZoomLevelSet.ZoomLevel15.DefaultAreaStyle.FillSolidBrush = yellowBrush
shapeLayer.ZoomLevelSet.ZoomLevel15.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red
shapeLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle = styleText6
shapeLayer.ZoomLevelSet.ZoomLevel15.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level15
shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush = yellowBrush
shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red
shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
End Sub
Taylor,
I am not sure how relevant my answer is going to be for your case but I think you may get some help from looking at the following two samples from the Code Community Multi Column Labeling and Multiple Labels
wiki.thinkgeo.com/wiki/Map_Suite_We...n_Labeling
wiki.thinkgeo.com/wiki/Map_Suite_We...ple_Labels
I think this is going to inspire you for the aspect of displaying labels from multiple column. For the Web specific questions, if you still have some, I will get some help from the Web team for that. Thank you.
Taylor,
After rereading your last post, I think that you got confused on how to set the columns for the TextStyle. You need to be aware that there is the property TextColumnName of TextStyle where you can set your column names. Once you know that, I think you have a good grasp on the javascript part. If you are still in the dark, let us know and I will get some help from the Web team. Thank you.