O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Setting up the controller

We will set up our controller as computerList.controllers.ComputerListController.

It will have to handle actions on the different view's elements (particularly when the user clicks the add button).

Note that we will create another view after that for each row of the table (it will be a ComputerView).

Therefore, here is our ComputerListController.hx file:

package computerList.controllers; import js.Dom; import js.Lib; import computerList.models.Computer; class ComputerListController { var listBody:js.HtmlDom; var nameField:js.Text; var osField:js.Select; var detailsField:js.Text; var addButton:js.Button; public function new() { listBody = untyped Lib.document.getElementById ("listTable").tBodies[0]; nameField ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required