具有KnockoutJS ListView问题的jQuery Mobile [英] jQuery Mobile with KnockoutJS ListView Issue

查看:83
本文介绍了具有KnockoutJS ListView问题的jQuery Mobile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个我正在尝试的示例,列表视图的外观看起来并没有很好的显示效果,

This example of what I am trying, the listview doesn't end up with nice looks,

任何人都可以建议我做错了什么.这是专门在data-inset = true上发生的.

Can anyone please suggest what I am doing wrong. this is happening specifically on data-inset=true.

http://jsfiddle.net/xQ9Uu/1/

如果我这样设置的话,可以,但是列表不是真的.

if I set like this, its ok but its not really the list.

<ul id="alarmslist" data-bind="foreach: days" data-role="listview">

真正实现数据插入会破坏设计.

making the data-inset true breaks the design.

 <ul id="alarmslist" data-bind="foreach: days" 
data-inset="true" data-role="listview">

谢谢.

推荐答案

在更新后刷新列表视图应该可以解决您的问题.为此,您可以使用自定义绑定:

Refreshing the list view after update should solve your problem. For that you can use a custom binding:

ko.bindingHandlers.jqmRefreshList = {
    update: function (element, valueAccessor) {
        ko.utils.unwrapObservable(valueAccessor()); // make this update fire each time the array is updated.
        $(element).listview("refresh")
    }
};

在HTML中:

<ul id="alarmslist" data-bind="foreach: days, jqmRefreshList: days" data-inset="true" data-role="listview">

这是工作中的小提琴: http://jsfiddle.net/xQ9Uu/44/

Here is the working fiddle: http://jsfiddle.net/xQ9Uu/44/

这篇关于具有KnockoutJS ListView问题的jQuery Mobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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