Disabling user input within a Marionette collection view - that is being updated by other parts of the application

StackOverflow https://stackoverflow.com/questions/23575321

質問

Need to disable input buttons for items within a Marionette collection view.

Normally I'd just do:

TheView.$el.find('input').prop('disabled', true);

That should disabled all input elements within the view.

The problem I am having is that other parts of the application are updating that view, as a result anything new that comes into the view is not disabled.

What is a good pattern for dealing with this situation?

役に立ちましたか?

解決

INHO its not very good to work with ItemView elements from collection view - its better to use custom event or move disable logick to item view.

In case you have other modules updating the view - if i were you i would move disable term in ItemView template - in this case any update will check this term and render input correctlly.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top