Dojo移动和回调在dojox.mobile.ListItem [英] Dojo mobile and callback in dojox.mobile.ListItem

查看:107
本文介绍了Dojo移动和回调在dojox.mobile.ListItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是一个dojo新手,在手机版本中遇到这个问题:我尝试使用javascript函数使用回调,但是它不会工作。做错了?

 < script> 
函数My_function(){
alert(Hello);
}
< / script>

< div id =homepage_viewdata-dojo-type =dojox.mobile.View>

< h1 data-dojo-type =dojox.mobile.Heading> Mobile ....< / h1>

< ul data-dojo-type =dojox.mobile.RoundRectList>
< li data-dojo-type =dojox.mobile.ListItem
data-dojo-props ='moveTo:whereIam_view,
transition:slide,
回调:My_function(),
'> sth ....< / li>
< li data-dojo-type =dojox.mobile.ListItem
data-dojo-props ='moveTo:places_aroud_me_view,
transition:slide'> sth别的....< /锂>
< li data-dojo-type =dojox.mobile.ListItem
data-dojo-props ='moveTo:places_in_koszalin_view,
transition:slide'> sth甚至更多其他....< / li>
< / ul>

< / div>

Thanx提前提供帮助。

解决方案

您可以使用引用而不是函数名字符串。
而不是:

  function My_function(){
alert(Hello);
}

使用:

  functionName = function My_function(){
alert(Hello);
}

然后在prop

  data-dojo-props ='moveTo:whereIam_view,
transition:slide,
callback:functionName,
'> ;某物....< /锂>

记住!没有关于functionName


的引号

I'm a dojo newbie and have encountered this problem in mobile version: I try to use callback with javascript function, but it wont work.

What am I doing wrong?

<script>
function My_function(){
    alert("Hello");
}
</script>

<div id="homepage_view" data-dojo-type="dojox.mobile.View">

  <h1 data-dojo-type="dojox.mobile.Heading">Mobile....</h1>

  <ul data-dojo-type="dojox.mobile.RoundRectList">
    <li data-dojo-type="dojox.mobile.ListItem"
        data-dojo-props='moveTo:"whereIam_view",
                         transition:"slide",
                         callback:"My_function()",
                         '>sth....</li>
    <li data-dojo-type="dojox.mobile.ListItem"
        data-dojo-props='moveTo:"places_aroud_me_view",
                         transition:"slide"'>sth else....</li>
    <li data-dojo-type="dojox.mobile.ListItem"
        data-dojo-props='moveTo:"places_in_koszalin_view",
                         transition:"slide"'>sth even more else....</li>                         
  </ul>

</div>

Thanx for help in advance.

解决方案

You could use reference instead of function name string. Instead of:

function My_function(){
alert("Hello");
}

Use:

functionName = function My_function(){
alert("Hello");
}

And then inside the prop

 data-dojo-props='moveTo:"whereIam_view",
                         transition:"slide",
                         callback:functionName,
                         '>sth....</li>

Remember! Without the quotes around the functionName

这篇关于Dojo移动和回调在dojox.mobile.ListItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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