自动向数据视图添加行? [英] Automatically add rows to a Data View?

查看:29
本文介绍了自动向数据视图添加行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用数据视图控件和 Pager Add Rows 控件来允许用户向数据视图添加更多行.

是否可以扩展 Pager Add Rows 控件以在用户到达屏幕底部时自动向数据视图添加行?

解决方案

是的,您可以使用 jquery 轻松做到这一点.如果你掌握了道场,你可能可以用类似的方式来做.但是这个例子展示了 jQuery.

  1. 将 jQuery 添加到您的 xpage
  2. 向您的 xpage 添加新的自定义脚本库
  3. 将以下代码放入您的自定义脚本库
  4. 将 addPageRows 控件添加到您的 xpages 并将其连接到重复.
  5. 一切就绪,试试吧.

<块引用>

$(function(){$(窗口).滚动(功能(){if($(window).scrollTop() == $(document).height() - $(window).height()){$("[id$='pagerAddRows1_ar'],[id$='pagerAddRows2_ar']").click();}});})

jquery 代码会尝试找到 pagerAddRows1_ar 或 pagerAddRows2_ar,如果找到,当你到达屏幕底部时会自动点击链接.

您实际上可以将此代码与您的 xpage 上的任何类型的寻呼机或链接一起使用.只需确保您的代码点击了正确的 ID.

I am using a Data View control and the Pager Add Rows control to allow the user to add more rows to the data view.

Can I extend the Pager Add Rows control to automatically add rows to the Data View when the user reaches the bottom of screen?

解决方案

Yes, you can do that easily with jquery. if you master dojo you can probably do it in similar ways. but this example show jQuery.

  1. add jQuery to your xpage
  2. add a new custom scriptlibrary to your xpage
  3. put below code in your custom scriptlibrary
  4. Add a addPageRows control to your xpages and connect it to a repeat.
  5. All set, try it out.

$(function(){
  $(window).scroll(function(){
        if($(window).scrollTop() == $(document).height() - $(window).height()){
            $("[id$='pagerAddRows1_ar'],[id$='pagerAddRows2_ar']").click();
                  }
        });
})

The jquery code will try and find pagerAddRows1_ar or pagerAddRows2_ar and if found will click the link automatically when you reach the bottom of screen.

You can actually use this code with any kind of pager or link you have on your xpage. just make sure your code click the right id.

这篇关于自动向数据视图添加行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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