DoJox.Mobile.CurrentViewは、あるタブから別のタブに移動した後はNULLです。
-
12-12-2019 - |
質問
次のタブコントロールを使用しています。
function tweetsAction()
{
var w = dojox.mobile.currentView;
if (w.id != "tweetsView") w.performTransition('tweetsView', 1, "slide", null);
}
function secondAction()
{
var w = dojox.mobile.currentView;
if (w.id != "secondView") w.performTransition('secondView', 1, "slide", null);
}
function thirdAction()
{
var w = dojox.mobile.currentView;
if (w.id != "thirdView") w.performTransition('thirdView', 1, "slide", null);
}
.
Worklight JavaScriptの初期化:
function initCommonControls()
{
console.log("Android initCommonControls");
WL.TabBar.init();
WL.TabBar.addItem("tweetsView", tweetsAction, "Tweets", {image:"images/icons/help_bw.png", imageSelected:"images/icons/help.png"});
WL.TabBar.addItem("secondView", secondAction, "Second", {image:"images/icons/help_bw.png", imageSelected:"images/icons/help.png"});
WL.TabBar.addItem("thirdView", thirdAction, "Third", {image:"images/icons/help_bw.png", imageSelected:"images/icons/help.png"});
WL.TabBar.setSelectedItem("tweetsView");
}
.
タブがアプリの起動時にOK表示されます。
しかし、私が2番目または3番目のタブをクリックすると、どちらも最初のものを移動します。
とJSコンソールのJavaScriptエラーが表示されます。
アベニーTypeError:未定義
のプロパティ 'ID'を読み取ることができません
これは `var w= dojox.mobile.currentViewです。初期タブを移動した後に現在のビューを取得できません。
これは私のHTMLがどのように見えるものです:
<!-- Tweets View -->
<div id="tweetsView" data-dojo-type="dojox.mobile.ScrollableView" data-dojo-props="selected: true">
<div class="spacing"></div>
<h1 id="head0" data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'Tweet Search', fixed:'top'"></h1>
<button onclick="getTweets()">Get Tweets</button>
<input data-dojo-type="dojox.mobile.TextBox" id="sampleItem">
<ul data-dojo-type="dojox.mobile.EdgeToEdgeList" id="theTable"
class="tweetviewList">
</ul>
</div>
<!-- second View -->
<div id="secondView" data-dojo-type="dojox.mobile.ScrollableView" data-dojo-props="selected:false">
<div class="spacing"></div>
<h1 data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'second view', fixed:'top'"></h1>
This is a second view
</div>
<!-- third View -->
<div id="thirdView" data-dojo-type="dojox.mobile.ScrollableView" data-dojo-props="selected:false">
<div class="spacing"></div>
<h1 data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'third view', fixed:'top'"></h1>
This is a third view
</div>
.
Tabを切り替えた後にdojox.mobile.currentView
が何も返している理由に関するアイデアは?
解決
これはこれに関連していると思います。 http://bugs.dojotoolkit.org/ticket/15040。Dojo Mobileの最新バージョンからDojox.Mobile.currentViewを削除したように聞こえます。私は現在Worklightを使っていくつかのものをやっています、そして私はdojox.mobile.currentViewに「未定義」を得ています。
そのページにいくつかの推奨事項がありますが、それはすべてがはるかに複雑である必要があるように見えます - yay:(
所属していません StackOverflow