Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1077

Need Ability to Bind Multiple Views to Same ViewModel Instance

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 6.0.0
    • None
    • MVVM within Business Portal type layout where there is a min and max view for each portal child.

      Requested Feature:
      There should be a way to bind multiple views to the same instance of a viewmodel.

      Case scenario:
      In developing a business portal layout, using MVVM, and there is a min and max view for each portal child, it is essential to bind both the min and max view to the same view model instance. By so doing, a user can switch between the min and max views while maintaining the same bindings. Because the only way to bind a view to the viewmodel is through the @init annotation, which assumes the instantiation of a new viewmodel, switching between min and max view causes the user to reselect any selection criteria. For example, if the user selected a date range to view a list of their invoice batches while in min view, they must reselect the criteria and re-request the collection for the max view. If they could both use the same vm instance, this would be alleviated.

      Recommended solutions:
      I would suggest the ability to bind a view to a viewmodel by @init'ing to a viewmodel factory class. This would allow a developer to create a factory class that returns the same viewmodel instance per idspace, or any other grouping, desired.

      To facilitate the above feature, the viewmodel factory should have a means to get the uuid of the calling component. This could be accomplished via the Executions or Sessions object.

      Summary:
      It seems to me the power of MVVM, and decoupling the view from the viewmodel, is that we can bind multiple views (min, max, mobile, iPad, etc) to the same viewmodel, but it loses much of its power if the developer can't bind all those views to the same viewmodel instance so that there is a smooth transition from min to max and back, or from mobile to min, or iPad to max, etc.

            Unassigned Unassigned
            rdgrimes rdgrimes
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: