在动态创建的可折叠集内刷新可合并列表(Refresh Collaspible List within dynamically created Collapsible

编程入门 行业动态 更新时间:2024-10-28 08:30:55
在动态创建的可折叠集内刷新可合并列表(Refresh Collaspible List within dynamically created Collapsible-set)

关于jsFiddle的示例代码: http : //jsfiddle.net/MqDFt/6/

对此的背景是,它是一个出现的对话窗口,当用户开始输入搜索查询时,它会显示一些找到的结果。 以下是从PHP通过AJAX返回的结果示例:

<div data-role='collapsible' data-mini='true'> <h3>appcent.com<span style='float: right;margin-top: -16px;padding-right: 10px;'>(1)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=87e2a2ef68c71c220d6a519ab6d668b2'><span style='float: left;'>appcent.com</span><span style='float: right;'>2012-01-30 19:02:46</span></a></li> </ul> </div> <div data-role='collapsible' data-mini='true'> <h3>apallen.net<span style='float: right;margin-top: -16px;padding-right: 10px;'>(2)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=8df9e81f2245f9cae41f1e95899598b3'><span style='float: left;'>apallen.net</span><span style='float: right;'>2010-07-30 15:37:32</span></a></li> <li><a href='adv_dns_displayResults.php?lid=a9387b995e88c7573141451546839e96'><span style='float: left;'>apallen.net</span><span style='float: right;'>2010-07-30 15:37:32</span></a></li> </ul> </div> <div data-role='collapsible' data-mini='true'> <h3>aptfire.com<span style='float: right;margin-top: -16px;padding-right: 10px;'>(2)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=7de36861bcc8a2064ce7f428cc384c8c'><span style='float: left;'>aptfire.com</span><span style='float: right;'>2011-10-13 10:29:16</span></a></li> <li><a href='adv_dns_displayResults.php?lid=bf8c93976d5bba46b7313b9bb990ef3c'><span style='float: left;'>aptfire.com</span><span style='float: right;'>2011-10-13 10:29:18</span></a></li> </ul> </div>

Collapsible-Set正常刷新,但listview没有。 我试图刷新列表视图,触发创建,以及其他东西的组合。

Example Code on jsFiddle: http://jsfiddle.net/MqDFt/6/

Background on this, it is a dialog window that appears, and upon the user starting to enter a search query, it displays a number of results found. Here is an example of the results that would be returned via AJAX from PHP:

<div data-role='collapsible' data-mini='true'> <h3>appcent.com<span style='float: right;margin-top: -16px;padding-right: 10px;'>(1)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=87e2a2ef68c71c220d6a519ab6d668b2'><span style='float: left;'>appcent.com</span><span style='float: right;'>2012-01-30 19:02:46</span></a></li> </ul> </div> <div data-role='collapsible' data-mini='true'> <h3>apallen.net<span style='float: right;margin-top: -16px;padding-right: 10px;'>(2)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=8df9e81f2245f9cae41f1e95899598b3'><span style='float: left;'>apallen.net</span><span style='float: right;'>2010-07-30 15:37:32</span></a></li> <li><a href='adv_dns_displayResults.php?lid=a9387b995e88c7573141451546839e96'><span style='float: left;'>apallen.net</span><span style='float: right;'>2010-07-30 15:37:32</span></a></li> </ul> </div> <div data-role='collapsible' data-mini='true'> <h3>aptfire.com<span style='float: right;margin-top: -16px;padding-right: 10px;'>(2)</span></h3> <ul data-role='listview'> <li><a href='adv_dns_displayResults.php?lid=7de36861bcc8a2064ce7f428cc384c8c'><span style='float: left;'>aptfire.com</span><span style='float: right;'>2011-10-13 10:29:16</span></a></li> <li><a href='adv_dns_displayResults.php?lid=bf8c93976d5bba46b7313b9bb990ef3c'><span style='float: left;'>aptfire.com</span><span style='float: right;'>2011-10-13 10:29:18</span></a></li> </ul> </div>

The Collapsible-Set refreshes properly, yet listview does not. I have tried to refresh the list view, trigger create, and a combination of other things.

最满意答案

这是正确的代码:

$("#pastSearchResults ul").each(function(i) { $(this).listview(); });

笔记:

使用简化的选择器返回div“#pastSearchResults”下的所有“ul”标签 选择器返回一个列表,而不仅仅是一个项目,因此迭代它 调用listview()没有参数“刷新”,因为这是第一个创建列表(不旧和刷新)

Here is the correct code:

$("#pastSearchResults ul").each(function(i) { $(this).listview(); });

Notes:

Use simplified selector which returns all "ul" tags under div "#pastSearchResults" The selector return a list, not just one item so iterate over it Call listview() without param "refresh" since this is the first the list is created (not old and refreshed)

更多推荐

本文发布于:2023-08-05 23:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1440090.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可折叠   动态   列表   Refresh   Collaspible

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!