2014-05-04 19 views
0

我已经设置了简单的DojoX中/应用的移动应用有两种观点,上市细节:在Dojo应用程序进行过渡

"defaultView": "list", 
"views": { 
    "list": { 
     "controller": "comp/controller/list", 
     "template": "comp/view/list.html" 
    }, 
    "details" : { 
     "controller": "comp/controller/details", 
     "template": "comp/view/details.html" 
    } 
} 

控制器被正确地显示了在listItems中的名单,我已经设置一个点击处理程序,以过渡到细节:

t.onClick = lang.hitch(t, function() { 
    this.transitionTo("details", 1, "slide", null); 
}); 

但它不起作用。事实上,我发现列表变成蓝色约300毫秒,但仍然保持在同一视图中,没有控制台警告或错误。根本不值一提。

也试过声明做的HTML没有成功:

<div id="data" data-dojo-type="dojox/mobile/ScrollableView" data-dojo-props="selected: true"> 
    <div id="dataHeading" data-dojo-type="dojox/mobile/Heading" data-dojo-props="fixed: 'top', label: 'All'"> 
     <span data-dojo-type="dojox/mobile/ToolBarButton" 
       data-dojo-props="icon: 'img/settings.png'" 
       style="float:left;"></span> 
     <span id="refreshButton" 
       data-dojo-type="dojox/mobile/ToolBarButton" 
       data-dojo-props="icon: 'img/refresh.png', moveTo: 'details'" 
       style="float:right;"></span> 
    </div> 
    <div id="datasList" data-dojo-type="dojox/mobile/EdgeToEdgeList"> 
    </div> 
</div> 

任何帮助吗?谢谢

回答

0

文档是有点混乱,至少道场1.9

发现这几种解决方案:

或者使用target属性(未对moveTo),所以上面的跨度会

<span id="refreshButton" 
      data-dojo-type="dojox/mobile/ToolBarButton" 
      data-dojo-props="icon: 'img/refresh.png', target: 'details'" 
      style="float:right;"></span> 

或代码

var t = new ListItem(data); 
t.target = "details"; 

明确由你使用dojox/apptransitionToView功能

beforeActivate: function (previousView, data) { 
    (...) 
    var t = new ListItem(data); 
    //t.target = ""; this will be handle in the onClick event 
    t.clickable = true; 
    t.placeAt(this.list, "last"); 
    t.onClick = lang.hitch(this, function() { 
     this.app.transitionToView(this.domNode, { 
      target: "details" }); 
    }); 
} 

或通过TransitionEvent模块,这似乎是正确的方式

beforeActivate: function (previousView, data) { 
    (...) 
    var t = new ListItem(data); 
    //t.target = ""; this will be handle in the onClick event 
    t.clickable = true; 
    t.placeAt(this.list, "last"); 
    t.onClick = lang.hitch(this, function() { 
     new TransitionEvent(this.domNode, { 
      target: "details", 
      transition: "slide", 
      transitionDir: 1 
     }).dispatch(); 
    }); 
} 
相关问题