Documentation

include MVC MVC.Animate MVC.Class MVC.Controller MVC.Controller.Action MVC.Controller.Action.Drag MVC.Controller.Action.Drop MVC.Controller.Action.EnterLeave MVC.Controller.Action.Event MVC.Controller.Action.Hover MVC.Controller.Action.Lasso MVC.Controller.Action.Selectable MVC.Controller.Action.Subscribe MVC.Controller.Comet MVC.Controller.Params MVC.Controller.Params.Drag MVC.Controller.Params.Drop MVC.Controller.Stateful MVC.Delegator MVC.Doc MVC.Element MVC.Event MVC.File MVC.History MVC.IO MVC.IO.Ajax MVC.IO.Comet MVC.IO.JsonP MVC.IO.WindowName MVC.IO.XDoc MVC.Model MVC.Model.Ajax MVC.Model.Cookie MVC.Model.JsonP MVC.Model.JsonRest MVC.Model.WindowName MVC.Model.XmlRest MVC.Native MVC.Native.Array MVC.Native.Date MVC.Native.Function MVC.Native.Number MVC.Native.Object MVC.Native.String MVC.Options MVC.Store MVC.SyntheticEvent MVC.Test MVC.Test.Assertions MVC.Test.Controller MVC.Test.Functional MVC.Test.Runner MVC.Test.Unit MVC.Timer MVC.Timer.Easings MVC.Vector MVC.View MVC.View.Helpers OpenAjax

MVC.Controller.Params

Instances of Controller.Params are passed to Event based actions.

Example

MVC.Controller.extend('todos', {
   mouseover : function(params){ 
      params.element.style.backgroundColor = 'Red';
   },
   mouseout : function(params){
      params.element.style.backgroundColor = '';
      params.event.kill();
   },
   "img click" : function(params){
   	  params.class_element().parentNode.removeSibiling(params.class_element());
   }
})

Constructor

MVC.Controller.Params

new MVC.Controller.Params(params) -> mvc.controller.params

Creates a new Controller.Params object.

{Object} - An object you want to pass to a controller

Prototype Methods

class_element

class_element() -> HTMLElement
Returns the class element for the element selected
{HTMLElement} - the element that shares the controller's id or classname

element_instance

element_instance() -> undefined
Returns the model instance associated with dom this action acted on. It finds the class_element, then looks if it has an id that matches modelName_instanceId. It uses instanceID to look up the instnace in the model's store. If you change the controller's modelName it will use a different model to look up the data.

form_params

form_params() -> Object
Returns data in a hash for a form.
{Object} - Nested form data.

is_event_on_element

is_event_on_element() -> Boolean
Returns if the event happened directly on the element in the params.
{Boolean} - true if the event's target is the element, false if otherwise.