【问题标题】:Kendo UI Mobile Button剑道 UI 移动按钮
【发布时间】:2013-01-08 15:11:04
【问题描述】:

我正在尝试在我的移动应用上使用 kendo ui 移动框架。我必须在列表视图中动态创建按钮,并在点击功能上创建按钮。

如果我写在 html 正文中,一切正常,并且按钮在单击功能时表现正常。

<ul data-role="listview" data-style="inset" id="genericListView">
   <li>
        <input type="text">sample
             <a data-align="right" data-role="button" data-click="browse" id="browse"></a>
        </input>
   </li>
</ul>

但是如果我像下面这样写:

$('#genericListView').append('<li id="' + result[i].ListItemID + '"><input name="' + result[i].ListItemElementText + '"type="' + result[i].ListItemElementType + 
                        '" id="' + result[i].ListItemElementID + '">' + result[i].ListItemElementText + '<a data-align="left" data-role="button" id="' + result[i].ListItemElementBrowsableID + 
                        '" data-click="' + funcName + '"></a></input></li>');

按钮看起来像屏幕上的标签,当然点击功能不起作用。

我也尝试用

添加按钮

1.输入和按钮标签(不工作)

  1. 使用 document.createElement 创建按钮并尝试设置属性(不起作用)

  2. $('ul').listview('refresh'); (追加后,不工作)

  3. .trigger('create'); (追加后,不工作)

    我认为这是 android css(在 kendoui 移动框架中)的错误,因为它可以在 iOS 设备上正确运行。任何想法如何解决这个问题?还是我错过了什么?

【问题讨论】:

  • 输入元素不能有子元素。验证您的 HTML。

标签: android listview button kendo-ui listviewitem


【解决方案1】:

已修复:

$('#' + result[i].ListItemElementBrowsableID).kendoMobileButton({ 
                                click: function (event) {
                                    alert('foo');
                                }
                            });

如果您使用 kendoMobileButton 选项,则锚按钮看起来像一个按钮,并且在用户按下按钮时可以表现,here 是相同的解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多