Results 1 to 2 of 2

Thread: [MVC] where to fire business-level events

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2013

    Default [MVC] where to fire business-level events

    Hello there, I have question about recommended practise of designing MVC architecture in ExtJS.
    We have a View, where all component structure is defined.
    We have a ViewController, where all business logic, event handlers are implemented.

    I have one component [A] with datagrid and open special window [B] where user can choose one item from another grid and click 'apply' so window [B] should be closed and some logic should be processed in component [A]
    My question is where we should fire event of business-level in window [B] like 'user choosed an option so window is ready to close' with that option as a event parameter?
    - in view?
    - in viewController?

    I feel that viewController is main processing part of component and all control events, business methods should be placed here.
    But I think that placing events in component has many technical advantages like: ability to using component query to listen events in any viewController.control(...).

    What do you think?
    This quetion is not technical. It is only for good convention and design.

    The same question is where to put config variables (for business level)? ViewController or View?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    Your logic should be in a controller (global or view) as much as possible. If you fire an event on the controller (global or view) then any other controller can then listen to it via the listen config and the controller event domain.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts