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