IBM Worklight 6.1 - 无法进行正常的Dojo视图转换 [英] IBM Worklight 6.1 - Unable to have a working Dojo view transition

查看:138
本文介绍了IBM Worklight 6.1 - 无法进行正常的Dojo视图转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很喜欢工作环境工作,最近开始工作。



我正在使用dojo版本1.9(IBM支持的),工作灯6.1,操作系统Windows 7,eclipse juno sr2 64bit,IE 10(对于RPE),Google Chrome最新(作为默认浏览器)。



我在Dojo手机和所有他们工作正常,我也经历过其他问题,如Worklight 6.1 Android Applicaiton渲染所有视图没有小部件,并遵循解决方案中提供的所有步骤,并成功创建和查看了MBS和Android模拟器上的页面。
唯一的问题是我正在处理视图。我从dojo和TabBarButtons添加一个tabBar用于视图转换。还可以在页面中添加几个视图,并将其与按钮相链接。我还检查并看到我的main.js文件被所有包含的元素更新。
虽然工具栏与默认视图一起可见,但当我点击tabBar中的其他按钮时,它不会切换视图。
也在TabBarButtons上敲击Chrome控制台中的错误 -
未捕获TypeError:undefined不是函数



每次点击都会弹出此错误。



这里是index.html文件的body标签中的源代码的结构: -

 < body style =display:none;> 
< div data-dojo-type =dojox.mobile.Viewid =view2
data-dojo-props =selected:true>
< div data-dojo-type =dojox.mobile.Viewid =view0data-dojo-props =selected:true>
< div data-dojo-type =dojox.mobile.Heading
data-dojo-props =label:'Hello world'>< / div>

< button data-dojo-type =dojox.mobile.Button> Hello< / button>
< input data-dojo-type =dojox.mobile.TextBox>< input type =range
data-dojo-type =dojox.mobile.Slider
data-dojo-props =orientation:'H'>


< / div>
< div data-dojo-type =dojox.mobile.Viewid =view1
data-dojo-props =selected:false>
< div data-dojo-type =dojox.mobile.Heading
data-dojo-props =label:'关于',moveTo:'view0'>
< / div>
< div data-dojo-type =dojox.mobile.RoundRect>
您好,我们是创新领域的领先公司
< / div>
< / div>
< ul data-dojo-type =dojox.mobile.TabBarfixed =bottomid =Tab1>
< li data-dojo-type =dojox.mobile.TabBarButtondata-dojo-props =moveTo:view0,transition:'slide'id =tabB1> Home< / li>
< li data-dojo-type =dojox.mobile.TabBarButtondata-dojo-props =moveTo:view1,transition:'slide'id =tabB2>关于< / li>
< / ul>
< / div>
< script src =js / initOptions.js>< / script>
< script src =js / main.js>< / script>
< script src =js / messages.js>< / script>
< / body>

//所有都是默认代码,没有更改jquery版本或其他任何东西
I也尝试了以下的东西,没有一个似乎工作: -
- 从dojoLib / dojo / dojo / nls / core-web-layer.js和mobile-web-layer中的www文件夹中的文件和替换文件。 js文件。
- 将Tabbar从任何视图中直接转换为body标签和链接视图。
-将id属性添加到tabBar和tab按钮元素,并查看元素。
转出来提供缺少的库资源,并包含丢失的文件(如果有的话),重建项目并再次运行。

解决方案

p>主要问题(导致异常)是moveto属性视图id的缺少引号。应该是:

  data-dojo-props =moveTo:'view0',

一旦修正,您的样本就可以正常工作。



但还有另一个问题,时间设计一个:TabBar 固定属性仅在与ScrollableView一起使用时有意义(此属性确保标签栏不滚动并保持其底部位置)所以您的外部视图应该是一个ScrollableView
另外,请注意,嵌套视图带有一些限制,特别是使用'moveto'属性,如果后者包含在另一个父项中,则不能从视图转换到另一个视图。 p>

不要犹豫,看看dojox / mobile / tests中的各种测试以及文档


I am new to working with worklight enviroment and started working it on recently.

I am using dojo version 1.9 (the IBM supllied one) , worklight 6.1, OS windows 7, eclipse juno sr2 64bit, IE 10 (For RPE), Google chrome latest (As default browser).

I have tried many widgets in dojo mobile and all of them work fine, i have been through other questions too like "Worklight 6.1 Android Applicaiton renders all views with no widgets" and followed all steps given in the solution and successfully created and viewed the pages on both MBS and android emulator. The only problem is when i am working with views. I add a tabBar from dojo and TabBarButtons for view transitions . Also add a few views in the pages and link them with the buttons. I also check and see that my main.js file is updated with all included elements. Although the toolbar along with default view is visible it does not switch view when i click on other buttons in tabBar. also onclicking the TabBarButtons an error popsup in chrome console - Uncaught TypeError: undefined is not a function

This error pops up on each click .

here is the structure of my source code of in the body tag of index.html file :-

<body style="display: none;">
<div data-dojo-type="dojox.mobile.View" id="view2"
        data-dojo-props="selected:true">
    <div data-dojo-type="dojox.mobile.View" id="view0" data-dojo-props="selected:true" >
            <div data-dojo-type="dojox.mobile.Heading"
        data-dojo-props="label:'Hello world'"></div>

        <button data-dojo-type="dojox.mobile.Button">Hello</button>
        <input data-dojo-type="dojox.mobile.TextBox"><input type="range"
            data-dojo-type="dojox.mobile.Slider"
            data-dojo-props="orientation:'H'">


    </div>
    <div data-dojo-type="dojox.mobile.View" id="view1"
        data-dojo-props="selected:false">
        <div data-dojo-type="dojox.mobile.Heading"
            data-dojo-props="label:'About',moveTo:'view0'">
            </div>
        <div data-dojo-type="dojox.mobile.RoundRect">
        Hello, we are a leading company in innovations
        </div>
    </div>
    <ul data-dojo-type="dojox.mobile.TabBar" fixed="bottom" id="Tab1">
        <li data-dojo-type="dojox.mobile.TabBarButton" data-dojo-props="moveTo:view0,transition:'slide'" id="tabB1">Home</li>
        <li data-dojo-type="dojox.mobile.TabBarButton" data-dojo-props="moveTo:view1,transition:'slide'" id="tabB2">About</li>
    </ul>
    </div>
    <script src="js/initOptions.js"></script>
            <script src="js/main.js"></script>
            <script src="js/messages.js"></script>
    </body>

// Rest all is default code, no changes in jquery version or anything else I have also tried the following things and none of them seem to work:- -Copied and replaced files in www folder from dojoLib/dojo/dojo/nls/core-web-layer.js and mobile-web-layer.js files. -Kept the Tabbar out of any view directly into body tag and linked views to it. -Added id attribute to tabBar and tab button elements, and view elements. -turned off provide missing library resources and included missing files (if any) ,rebuilt the project and ran again.

解决方案

The main issue (causing the exception) is the missing quotes around the view ids of the moveto attributes. It should be:

data-dojo-props="moveTo:'view0',

Once fixed, your sample will work.

But there are another issue, this time a design one: the TabBar fixed property is only meaningful when used with a ScrollableView (this property ensures the tabbar is not scrolled and keeps its bottom position). So your outer view should be a ScrollableView instead. Also, note that nesting views come with some limitations. In particular, using the 'moveto' attribute you cannot transition from a view to another view if the latter is contained in another parent.

Do not hesitate to look at the various tests in dojox/mobile/tests and to the documentation

这篇关于IBM Worklight 6.1 - 无法进行正常的Dojo视图转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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