** * 返回总记录条数,总页数,当前页面数据,分页html * 根据分页选项,生成分页连接 下面是一个实例: func (this *MainController) Test() { var po util.PageOptions po.EnablePreNexLink = true po.EnableFirstLastLink = true po.LinkItemCount = 7 po.TableName = "help_topic" cp, _ := this.GetInt("pno")
(po *PageOptions, requestURI string)
| 75 | } |
| 76 | */ |
| 77 | func GetPagerLinks(po *PageOptions, requestURI string) (int, int, orm.RawSeter, html.HTML) { |
| 78 | str := "" |
| 79 | totalItem, totalpages, rs := GetPagesInfo(po.TableName, po.CurrentPage, po.PageSize, po.Conditions) |
| 80 | po = setDefault(po, totalpages) |
| 81 | DealUri(po, requestURI) |
| 82 | if totalpages <= po.LinkItemCount { |
| 83 | str = fun1(po, totalpages) //显示完全 12345678910 |
| 84 | } else if totalpages > po.LinkItemCount { |
| 85 | if po.CurrentPage < po.LinkItemCount { |
| 86 | str = fun2(po, totalpages) //123456789...200 |
| 87 | } else { |
| 88 | if po.CurrentPage+po.LinkItemCount < totalpages { |
| 89 | str = fun3(po, totalpages) |
| 90 | } else { |
| 91 | str = fun4(po, totalpages) |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | return totalItem, totalpages, rs, html.HTML(str) |
| 96 | } |
| 97 | |
| 98 | func GetPagerHtml(requestURI string, pageIndex, pageSize, totalCount int) html.HTML { |
| 99 | po := &PageOptions{ |
nothing calls this directly
no test coverage detected