12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ViewAttributecontrollerIddataBindingDescriptionIdentifies the data controller for this data view (). The controllerId value must match the idvalue provided for that component.Identifies the data model property that is bound to this component. This property providesthe value that the component displays:• If the dataBinding value is a simple property name, this is assumed to be a property withinthe data model class identified by the modelClass attribute.• Alternatively, dataBinding can provide a full package, class, and property name.dataBinding is generally suitable for components that display a single value (meters or controls).Each meter on a <strong>Zen</strong> page must supply a controllerId and a dataBinding. Controls donot support the data view interface, so cannot supply a controllerId, but if the form that containsthe controls has an associated data controller, each control within the form can supply adataBinding attribute that identifies which property it displays.onnotifyViewClient-side JavaScript expression that is executed each time the data controller associatedwith this data view raises an event. Generally this expression invokes a client-side JavaScriptmethod defined in the page class. This method becomes the “onnotifyView event handler”for the data view component.When providing a value for this attribute, use double quotes to enclose the value and singlequotes (if needed) within the JavaScript expression. For example:The JavaScript expression may contain <strong>Zen</strong> #()# runtime expressions.6.3.2 The Controller ObjectWhen you work with a data view component programmatically, you can obtain a reference to the associated%ZEN.Auxiliary.dataController object via the following properties of the %ZEN.Component.dataView interface:• controller — Use in JavaScript code that runs on the client side• %controller — Use in ObjectScript, Caché Basic, or Caché MVBasic code that runs on the server side6.3.3 Multiple Data ViewsWhenever a user modifies a value within one of the controls that is bound to a data controller, the data controller is notified.It is common for data views to share a controller; for example, different types of chart on the same page could share thesame data controller to display different visualizations of the same data, as in the following figure. If there are multipledata view components connected to the same data controller, they are all notified of any change to a bound control.For examples of shared data controllers, use Studio to view the classes ZENMVC.MVCChart and ZENMVC.MVCMeters. Theclass ZENMVC.MVCMeters uses the same data controller to provide values for a and several meters. The classZENMVC.MVCChart provides a and three charts that all use the same data controller. Try entering the followingURIs in the browser:http://localhost:57772/csp/samples/ZENMVC.MVCChart.clshttp://localhost:57772/csp/samples/ZENMVC.MVCMeters.clsWhere 57772 is the Web server port number that you have assigned to Caché.<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!