首页 \ 问答 \ Cakephp分页首页:1(Cakephp pagination first page page:1)

Cakephp分页首页:1(Cakephp pagination first page page:1)

在Cakephp 1中,分页的第一页也将页面:1放在网址中,我如何让CakePHP 2也这样做呢? 我知道我在某处读过它,但我似乎无法找到带有解决方案的页面。

我知道这是CakePHP自己的视觉/设计解决方案,但我需要那个页面:1部分。

我希望有一个人可以帮助我...


In Cakephp 1 the first page of pagination also put page:1 in the url, how do I get CakePHP 2 to also do that? I know I read it somewhere, but I can't seem to find that page with a solution.

I know it was a visual/design solution from CakePHP self, but I need that page:1 part.

I hope someone can help me...


原文:https://stackoverflow.com/questions/21833007
更新时间:2023-03-18 21:03

最满意答案

默认情况下,.data()按索引匹配现有元素。 如果希望它们与值或某些内部属性匹配,则必须为此提供函数。 在您的示例中,这将起作用:

.data(data, function(d) { return d; });

.data()文档

要控制数据如何连接到元素,可以指定键功能。 这取代了默认的by-index行为; 对新数据数组中的每个元素调用一次键函数,并对选择中的每个现有元素再次调用。


By default, .data() is matching the existing elements by index. If you want them to be matched by value or by some internal property, you have to provide a function for this. In your example, this will work:

.data(data, function(d) { return d; });

From the documentation for .data():

To control how data is joined to elements, a key function may be specified. This replaces the default by-index behavior; the key function is invoked once for each element in the new data array, and once again for each existing element in the selection.

相关问答

更多
  • 尝试同步不同的变化是相当困难的。 从根本上改变方法要好得多:使用flex来自动调整非悬停项目 .container { display: flex; border: solid 1px green; width: 100%; height: 100px; } .test { flex: 33% 1 1; background-color: lightgreen; margin: 10px; transition: flex-basis 1s 0.3s; ...
  • 您需要使动画足够长,以便所有元素都有机会在循环再次开始之前进行动画制作。 在这个例子中,你的第四元素只在2秒后开始动画。 过渡本身将需要一秒钟的时间,然后您可能需要稍微暂停一下,再说一秒,然后再重新启动第一个元素。 总共4秒。 所以你可能想要这样的东西: -webkit-animation: Fadein 4s infinite linear 。 但是,您还需要调整关键帧百分比,将每个关键帧除以4,因为您仍然希望转换本身只需要1秒。 @-webkit-keyframes FadeIn { 0% { o ...
  • var leftBtn = document.getElementById('leftBtn'), pushDiv = document.getElementById('pushDiv'); leftBtn.addEventListener("click", function() { pushDiv.style.right = "410px"; setTimeout( function() { pushDiv.style.right = "360px"; }, 6 ...
  • 您只需要将幻灯片类添加到容器中,因此不需要click事件中的所有其他内容。 $('.transition').on('click',function() { var container = $('.container'); container.addClass('slide'); }); 此外,更喜欢使用翻译转换而不是保证金。 他们的动画效果更好: .slide { transform: translate(-100%, 0); transition: transform 1s l ...
  • 我想你可能会误解时间表的运作方式(或者我误解了你的意图)。 与所有补间一样,默认情况下,时间轴立即开始播放。 因此,如果您正在使用一个时间轴并根据用户交互推断所有补间(意味着在您创建它和填充它之间的时间过去......并填充更多...),它的播放头已经有了高级。 我打赌这会让你的补间几乎立刻跳到他们的最终状态。 这不是一个错误 - 事情应该如何运作,尽管GSAP中有一些逻辑可以在某些情况下调整行为以使其更直观。 我看到几个选项: 只需使用TweenMax而不是TimelineLite。 像TweenMax. ...
  • 这与@ Max的解决方案类似,尽管当数组中的所有元素都是非负数时,我可以提前终止搜索。 这是因为右和和左和之间的差异会单调递减。 我的答案假定每边至少有一个元素,但它当然可以修改为允许一边为零。 码 def balance(arr) return nil if arr.size < 3 all_non_neg = (arr.min >= 0) enum = arr.to_enum last = enum.next diff = arr.reduce(:+)-last (1..arr. ...
  • 解决了我的问题。 对于将来可能需要这个的人来说,这是程序。 如果您正在使用Illustrator或任何其他可以导出到SVG的类似程序,您可能会遇到一个问题,即您使用任何类型转换的某些对象会以矩阵的形式导出。 现在,正如Robert Longson所提到的并且很好地给出了文档的链接,你不能为一般的矩阵形式制作动画。 所以解决这个问题的方法是转换矩阵,这样你就可以得到简单的转换形式,比如平移,旋转......等等。 这可以通过Robert Longson提供的链接轻松完成(非常感谢): http : //www ...
  • 默认情况下,.data()按索引匹配现有元素。 如果希望它们与值或某些内部属性匹配,则必须为此提供函数。 在您的示例中,这将起作用: .data(data, function(d) { return d; }); 从.data()的文档 : 要控制数据如何连接到元素,可以指定键功能。 这取代了默认的by-index行为; 对新数据数组中的每个元素调用一次键函数,并对选择中的每个现有元素再次调用。 By default, .data() is matching the existing elements b ...
  • 当父元素像这样悬停时,你可以调用内部元素的动画: .stationaryTrain:hover .stationary{ -moz-animation:.6s rotateRight infinite linear; -webkit-animation:.6s rotateRight infinite linear; -webkit-transition: all 2s ease; } 对于他们每个人都这样做,例如: .stationaryTrain:hover .still{ ...
  • 你的锚上的显示块应该这样做。 @media screen and (max-height: 450px) (index):82 .sidenav a { font-size: 18px; display: block; } 编辑 - 以下评论 除了OP的要求,锚点应该保持内联而不是“跳舞”,我会为边栏的位置设置动画而不是宽度。 function openNav() { document.getElementById("mySidenav").style.left = "0"; } f ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。