Appmaker:如何创建和访问全局变量? [英] Appmaker: How can I create and access global variables?

查看:56
本文介绍了Appmaker:如何创建和访问全局变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个充当开关的按钮,以使面板可见.当onClick事件触发时,我正在运行客户端脚本,如下所示:

I am trying to make a button which acts as a switch, enabling the visibility of a panel. I am running a client side script when the onClick event fires, which is the following:

function {
  if(app.datasources.global.item.hideshow===false)
    {
       *does one thing*
    }
    else if(app.datasources.global.item.hideshow===true)
    { 
       *does another*
    }
}

我的问题是,根据控制台错误日志,global(这是数据源).item似乎为空.似乎我正在尝试从数据库访问记录的一个属性,但是我想访问和编辑未附加到任何数据库的属性,它只是一个全局变量".

My problem is, that the global (which is the datasource).item seems to be a null according to the console error log. It seems like i am trying to access one property of a record from a database, but I would like to access and edit a property which is not attached to any database, it would be just a "global variable".

也许我说得不太好,但是我希望有人可以帮助我解决这个问题.预先谢谢你.

Maybe I haven't phrased it too well, but I hope somebody can help me out with this. Thank you in advance.

推荐答案

有几种方法可以做到这一点.此链接可能有助于 ontoggle事件.我可以看到的另一种方式是使用本地存储.

There are a few ways you could do this. This link may help ontoggle Event. Another way I could see doing this would be using local storage.

这篇关于Appmaker:如何创建和访问全局变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆