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.

Adding Behavior to the These statements add the buttons to an so that they will appear on the screen in a row. Each button definesits onclick method as a different client-side method.3. Add the corresponding new client-side methods to the page class:ClientMethod newRecord() [ Language = javascript ]{var controller = zen('patientData');controller.createNewObject();}And:ClientMethod updateRecord() [ Language = javascript ]{var controller = zen('patientData');}controller.update();And:ClientMethod deleteRecord() [ Language = javascript ]{var controller = zen('patientData');controller.deleteId(controller.getModelId());controller.createNewObject();}Each of these methods uses a different dataController method to achieve its purposes.4.5.Choose Build > Compile or Ctrl-F7 or theChoose View > Web Page or the icon.The following figure shows the form.icon.6.6.2.1 NewSuppose the user clicks New. Calling createNewObject immediately creates a new empty model. In the browser, everytime the user clicks New the form is emptied. After that, if the user completes the empty form and clicks Save, this invokesthe form’s save method. This (eventually) leads to a call to the data model’s %OnSaveSource method on the server.<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 167

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

Saved successfully!

Ooh no, something went wrong!