Skip to Content
0
Nov 13, 2020 at 11:18 PM

Move UI toggle button into template to which the ViewModel does not apply its bindings.

40 Views Last edit Nov 18, 2020 at 03:12 PM 6 rev

What I'm trying to do on the UI -
Move or duplicate the UI toggle button outside of the user page (so, into another template, like MainMenu) (we had to hide user page to prevent changes to date formats and other fields, which affect how data is exported and potentially other processes):

The issue I'm running into -
The button uses a data-bound function, and each template has bindings applied (using element Id) from a different ViewModel.

Since we can't edit the js files to apply the binding to an additional element, what are my options?

  1. ⚡ Changing target template's main div's id was a bad idea.
  2. ⬜ Wrap new button in div with same id as source template?
    - I hear duplicate id's are bad.
    - Would the 2 ViewModels interfere with each other? If so, can the main one be paused or cleared for only the added button element?
  3. ⬜ Should I try to recreate that part of the ViewModel in a <script> tag within the target template?
  4. Something else?

Thank you.