热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

YUIDataTable-Howto只有一个分页器?-YUIDataTable-Howtohavejustonepaginator?

ImusingtheYUIDataTableinaGrails1.1projectusingtheGrailsUIplugin1.0.2(YUIbeing2.6.

I'm using the YUI DataTable in a Grails 1.1 project using the Grails UI plugin 1.0.2 (YUI being 2.6.1).

我使用Grails UI插件1.0.2(YUI为2.6.1)在Grails 1.1项目中使用YUI DataTable。

By default, the DataTable displays 2 paginators: one above and another one below the table. Looking up the YUI API documentation, I could see that I can pass an array of YUI containers as a config parameter but - what are the names of these containers?

默认情况下,DataTable显示2个分页器:一个在上面,另一个在表下面。查看YUI API文档,我可以看到我可以将一组YUI容器作为配置参数传递但是 - 这些容器的名称是什么?

I've tried loooking at the HTML of the page using Firebug. The ID of the divs containing the paginators are: yui-dt0-paginator0 (above) and yui-dt0-paginator1 (below). If I use them to configure the containers for the navigator, then the navigator is just not displayed at all. Here's the relevant extract of the GSP page containing the Datatable element.

我尝试使用Firebug来浏览页面的HTML。包含分页符的div的ID是:yui-dt0-paginator0(上面)和yui-dt0-paginator1(下面)。如果我使用它们为导航器配置容器,则根本不显示导航器。这是包含Datatable元素的GSP页面的相关摘录。

    

This is the List of Control Accounts

${flash.message}

Any help?

Thanks!

Rollo

3 个解决方案

#1


Ok, I have it now. Posting it here in case someone bumps into the same question.

好的,我现在拥有它。如果有人碰到同样的问题,请在此处发布。

So what you have to do is create a 'container' (a DIV will do) by whatever id, and reference it into the containers configuration item. Example:

所以你要做的就是用任何id创建一个'容器'(DIV会做),并将它引用到容器配置项中。例:

This is the List of Control Accounts

${flash.message}

You just have to make sure that the class associated to the div is yui-pg-container. As an added bonus, the style on that div will align the paginator to the right.

您只需确保与div关联的类是yui-pg-container。作为额外的奖励,该div上的样式将使分页器与右侧对齐。

Rollo

#2


With YUI 2.8.0 (and maybe with 2.6 as well) there is an easier way. Just add the styles:

使用YUI 2.8.0(也可能是2.6),有一种更简单的方法。只需添加样式:

.yui-skin-sam .yui-dt-paginator {
    text-align:right;
} 

#yui-dt0-paginator1 {
    display:none;
}

This has the advantage that the paginator is aligned to the tables right border. If you want to have the pagination at the bottom of the table, just change yui-dt0-paginator1 to yui-dt0-paginator0.

这具有以下优点:分页器与表右边界对齐。如果你想在表格的底部加上分页,只需将yui-dt0-paginator1更改为yui-dt0-paginator0即可。

#3


I have many tens of YUI datatables and didn't want to have to write a selector for each one so here is what I did. Create a 'container' div around each datatable then use the first-child selector to set the visibility to hidden like so:

我有几十个YUI数据表,并且不想为每个数据表写一个选择器,所以这就是我所做的。在每个数据表周围创建一个“容器”div,然后使用第一个子选择器将可见性设置为隐藏,如下所示:

.container_div .yui-dt-paginator:first-child {
    visibility:hidden;
}

note .container_div can be called what ever you like.

注意.container_div可以随叫随到。

Thanks to both Rollo and jm for the inspiration, it's kind of a mashup of both ideas.

感谢Rollo和jm的灵感,这是两种想法的混搭。


推荐阅读
  • 本文介绍了在rhel5.5操作系统下搭建网关+LAMP+postfix+dhcp的步骤和配置方法。通过配置dhcp自动分配ip、实现外网访问公司网站、内网收发邮件、内网上网以及SNAT转换等功能。详细介绍了安装dhcp和配置相关文件的步骤,并提供了相关的命令和配置示例。 ... [详细]
  • SpringBoot uri统一权限管理的实现方法及步骤详解
    本文详细介绍了SpringBoot中实现uri统一权限管理的方法,包括表结构定义、自动统计URI并自动删除脏数据、程序启动加载等步骤。通过该方法可以提高系统的安全性,实现对系统任意接口的权限拦截验证。 ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • Python SQLAlchemy库的使用方法详解
    本文详细介绍了Python中使用SQLAlchemy库的方法。首先对SQLAlchemy进行了简介,包括其定义、适用的数据库类型等。然后讨论了SQLAlchemy提供的两种主要使用模式,即SQL表达式语言和ORM。针对不同的需求,给出了选择哪种模式的建议。最后,介绍了连接数据库的方法,包括创建SQLAlchemy引擎和执行SQL语句的接口。 ... [详细]
  • Imtryingtofigureoutawaytogeneratetorrentfilesfromabucket,usingtheAWSSDKforGo.我正 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • 使用在线工具jsonschema2pojo根据json生成java对象
    本文介绍了使用在线工具jsonschema2pojo根据json生成java对象的方法。通过该工具,用户只需将json字符串复制到输入框中,即可自动将其转换成java对象。该工具还能解析列表式的json数据,并将嵌套在内层的对象也解析出来。本文以请求github的api为例,展示了使用该工具的步骤和效果。 ... [详细]
  • 不同优化算法的比较分析及实验验证
    本文介绍了神经网络优化中常用的优化方法,包括学习率调整和梯度估计修正,并通过实验验证了不同优化算法的效果。实验结果表明,Adam算法在综合考虑学习率调整和梯度估计修正方面表现较好。该研究对于优化神经网络的训练过程具有指导意义。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 有没有一种方法可以在不继承UIAlertController的子类或不涉及UIAlertActions的情况下 ... [详细]
  • 开发笔记:Java是如何读取和写入浏览器Cookies的
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了Java是如何读取和写入浏览器Cookies的相关的知识,希望对你有一定的参考价值。首先我 ... [详细]
  • iOS Swift中如何实现自动登录?
    本文介绍了在iOS Swift中如何实现自动登录的方法,包括使用故事板、SWRevealViewController等技术,以及解决用户注销后重新登录自动跳转到主页的问题。 ... [详细]
  • 本文介绍了在iOS开发中使用UITextField实现字符限制的方法,包括利用代理方法和使用BNTextField-Limit库的实现策略。通过这些方法,开发者可以方便地限制UITextField的字符个数和输入规则。 ... [详细]
  • Android源码中的Builder模式及其作用
    本文主要解释了什么是Builder模式以及其作用,并结合Android源码来分析Builder模式的实现。Builder模式是将产品的设计、表示和构建进行分离,通过引入建造者角色,简化了构建复杂产品的流程,并且使得产品的构建可以灵活适应变化。使用Builder模式可以解决开发者需要关注产品表示和构建步骤的问题,并且当构建流程发生变化时,无需修改代码即可适配新的构建流程。 ... [详细]
author-avatar
小猪朱一凡
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有