如何通过worklight客户端API在页面之间传递数据 [英] How to pass data between pages through worklight client API

查看:127
本文介绍了如何通过worklight客户端API在页面之间传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个页面中调用一个过程并在另一个页面中使用它,并且响应仅在下一页使用,所以我认为JsonStore不适合。我应该定义全局变量吗?
是否有任何代码示例可以执行此类操作?谢谢你的帮助。

I want to invoke a procedure in one page and use it in another page, and the response is only used by the next page, so I think JsonStore is not suit for that. Should I define a global var? Is there any code sample to do such things? Thanks for your help.

推荐答案

我用页面假定你的意思是不同的HTML文件。如果是这样,建议不要这样做, Worklight适用于单页面应用程序。没有代码示例显示如何执行此操作。

I presume by pages you mean different HTML files. If so, that is not recommended, Worklight is intended for single page applications. There are no code samples that show how to do that.

我建议使用单个HTML页面并使用类似 jQuery.load 注入新的HTML / DOM元素。通过动态注入新的HTML,您的单个/主HTML文件不应该太大,您可以销毁(即从内存/ DOM中删除)未使用的DOM元素。在Google上搜索页面片段 html模板可以帮助您查找示例。这个想法是你不会丢失JavaScript上下文。

I would recommended having a single HTML page and using something like jQuery.load to inject new HTML / DOM elements. By dynamically injecting new HTML your single/main HTML file shouldn't be too big and you can destroy (i.e. remove from memory / the DOM) unused DOM elements. Searching on Google for page fragments and html templates could help you find examples. The idea is that you don't lose the JavaScript context.

也许你可以做一个新的 init 重新初始化JSONStore(它不会删除任何数据,只是让你访问) HTML页面并使用获取以访问JSONStore集合以执行操作,例如查找

Maybe you can get away with doing a new init to re-initialize JSONStore (it won't delete any the data, just give you access) on every new HTML page and use get to get access to the JSONStore collections to perform operations such as find.

这篇关于如何通过worklight客户端API在页面之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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