From 8b2e668680ca182d6a4f08daa90efe6dcb72d66f Mon Sep 17 00:00:00 2001 From: Nathan Angelacos Date: Sat, 5 Jul 2008 15:12:02 +0000 Subject: Demo calling a sub controller's model functions directly git-svn-id: svn://svn.alpinelinux.org/acf/sandbox/trunk@1283 ab2d0c66-481e-0410-8bed-d214d4d58bed --- loadingdemo-controller.lua | 9 ++++++++- loadingdemo-read-html.lsp | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/loadingdemo-controller.lua b/loadingdemo-controller.lua index d259d2c..817196a 100644 --- a/loadingdemo-controller.lua +++ b/loadingdemo-controller.lua @@ -5,6 +5,13 @@ default_action = "read" function read(self) local versioncontroller = self:new("alpine-baselayout/alpineversion") local versionresult = versioncontroller:read() + + -- Here's how you call the model directly + local modelresult = versioncontroller.model:get() + versioncontroller:destroy() - return cfe({ value="I called alpineversion:read(), and you are running version "..versionresult.value, label="Alpine version" }) + + return cfe({ controller="I called alpineversion:read(), and you are running version "..versionresult.value, + model="The model call to get() returned " .. modelresult.value + }) end diff --git a/loadingdemo-read-html.lsp b/loadingdemo-read-html.lsp index 168a2c1..4890b40 100644 --- a/loadingdemo-read-html.lsp +++ b/loadingdemo-read-html.lsp @@ -2,4 +2,12 @@

Example of Loading Another Controller

I am /
- + +

SubController Result

+ + + +

SubController - MODEL - Result

+ + + -- cgit v1.2.3