none
V8 - can't update InfoboxActions labels after Infobox has been created RRS feed

  • Question

  • I'm trying to update the label of an InfoboxActions object after I've already created the Infobox object.  The buttons are toggle buttons, so I need the labels to reflect the current state (i.e. selected/unselected).  So far, I've had no luck.  Just updated the "label" property of the InfoboxActions object has no effect, and even calling Infobox.SetOptions() does not update it.  Anyone have a solution?

    And on a side-note, is there any way to set a "disabled" property on the action buttons?  I need to sometimes conditionally enable/disable these buttons.


    Craig Hutchison Software Engineer Experient, Inc.

    Monday, September 19, 2016 3:23 PM

Answers

  • Infobox Actions are primarily there for backwards compatibility as these existed in the previous version of Bing Maps (with the same limitations). These are don't work well when reusing a single infobox instance. In V8 it is recommended to simply use custom HTML in the description and add your links there.

    [Blog] [twitter] [LinkedIn]

    Tuesday, September 20, 2016 12:21 AM

All replies

  • I think I figured out a workaround... If I just create a new array containing all of the same InfoboxActions' (so that it's a new array reference), then Bing Maps seems to recognize that a change has taken place and it updates the button labels... but it does not seem to just watch the array contents for changes, hence the need for a new array altogether.

    I would still like to know if there's any way to "disable" Infobox Actions?  Why can't <button type="button"> elements be used in place of <a href="javascript:void(0);"> elements to render the buttons?  You can style a <button> just like an <a> without much difficulty, and you get the added benefit of being able to disable it.


    Craig Hutchison Software Engineer Experient, Inc.

    Monday, September 19, 2016 4:25 PM
  • Infobox Actions are primarily there for backwards compatibility as these existed in the previous version of Bing Maps (with the same limitations). These are don't work well when reusing a single infobox instance. In V8 it is recommended to simply use custom HTML in the description and add your links there.

    [Blog] [twitter] [LinkedIn]

    Tuesday, September 20, 2016 12:21 AM
  • What I need are not so much links, but buttons.  I have a SPA application using Angular 2.0 and need to be able to attach event handlers to the buttons, which I can't do with simple custom HTML... I'd need a way of directly accessing the DOM element in order to create a custom implementation of what I want to do.

    Craig Hutchison Software Engineer Experient, Inc.

    Tuesday, September 20, 2016 11:19 PM
  • Ok, then use Infobox actions and don't reuse the infobox.

    [Blog] [twitter] [LinkedIn]

    Wednesday, September 21, 2016 2:03 AM
  • What about injecting HTML into the Infobox action's label?  I was doing this in V7 and wrapping a CSS class around it to mimic a disabled style, but now in V8 HTML seems to be escaped for the labels so that approach is no longer working for me.

    Craig Hutchison Software Engineer Experient, Inc.

    Wednesday, September 21, 2016 12:31 PM
  • Can you provide me a short code sample of what you were doing in V7 so I can take a look? I'll have a chat with the dev team to see if this is something we want to enable.

    [Blog] [twitter] [LinkedIn]

    Wednesday, September 21, 2016 7:38 PM