pagination

CakePHP 3.x Specify a Different Count Query for Pagination

混江龙づ霸主 提交于 2020-04-07 09:26:27
问题 I am trying to customize the pagination query for CakePHP I am using a Model based around a view. The view has some complex calculations in it and when the pagination runs it takes about 3 seconds to pull the 20 rows or so. Then it is running the same view wrapped in a count for the count used in pagination. I can run a simple table count on another table which would cut the load times in half but I am unable to find a simple way to customize a seperate query to run for the counts. Is this

javascript 分页组件

喜欢而已 提交于 2020-04-06 18:12:42
原文: javascript 分页组件 自己写的一个简单的分页组件,主要功能还有实现都在JS中,html页面中只用增加一个放置生成分页的DIV,并给定容器的id. html结构如下: <ul class="pagination" id="pageDIV"> </ul> class="pagination" 给定了分页的样式, id="pageDIV"用于放置JS生成的分页 CSS结构如下: .pagination{ margin-top: 10px; margin-bottom: 10px; display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px; } .pagination>li { display: inline; } .pagination>li:first-child>a{ margin-left: 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px; } .pagination>li>a{ position: relative; float: left; padding: 6px 12px; margin-left: -1px; line-height: 1.42857143; color: #337ab7

使用vue-awesome-swiper实现幻灯片组件开发

為{幸葍}努か 提交于 2020-04-06 10:16:56
vue的swiper组件 https://www.npmjs.com/package/vue-awesome-swiper 1、安装 swiper 和 vue-awesome-swiper 插件 cnpm install swiper vue-awesome-swiper --save (截图里只安装了vue-awesome-swiper,后面我又安装了swiper,大家自己补充下) 2、在 components目录下,创建slider目录,导入图片素材,创建index.vue <template> <swiper ref="mySwiper" :options="swiperOptions"> <swiper-slide v- for ="(slider,index) in sliders" :key="index"> <a :href="slider.linkUrl"> <img :src="slider.imgUrl"> </a> </swiper-slide> <div class="swiper-pagination" slot="pagination"></div> <div class="swiper-button-prev" slot="button-prev"></div> <div class="swiper-button-next" slot="button

Vue webAPP首页开发(二)

北城余情 提交于 2020-04-04 00:15:07
接上篇 https://www.cnblogs.com/chenyingying0/p/12612393.html Loading组件 在api--home.js中,添加代码,使ajax获取到轮播图数据后,延迟一秒再显示 import axios from 'axios'; import {SUCC_CODE,TIMEOUT} from './config'; //获取幻灯片数据 ajax export const getHomeSliders=()=>{ // es6使用promise代替回调 // axios返回的就是一个promise // return axios.get('http://www.imooc.com/api/home/slider').then(res=>{ // console.log(res); // if(res.data.code===SUCC_CODE){ // return res.data.slider; // } // throw new Error('没有成功获取到数据'); // }).catch(err=>{ // console.log(err); // //错误处理 // return [{ // linkUrl:'www.baidu.com', // picUrl:require('assets/img/404.png') //

angular9的学习(一)

穿精又带淫゛_ 提交于 2020-03-30 15:42:48
启动项目 ng new xxx --style=less --routing=true 如果引入UI框架的时间css不生效 在styles.less @import '../node_modules/....' 组件 如果需要修改组件的名称 @Component({ selector: 'app-new1',// 直接在这里修改 templateUrl: './new.component.html', styleUrls: ['./new.component.less'] }) <app-new1></app-new1> 如果修改成组件属性的型式 @Component({ selector: '[app-new1]', templateUrl: './new.component.html', styleUrls: ['./new.component.less'] }) <div app-new1></div> 如果修改组件的 app 的头部 tslint.json 添加 "component-selector": [ true, "element", "app", "sky", //添加 "kebab-case" ], @Component({ // selector: '[app-new1]', selector: '[sky-new1]', templateUrl: '.

easyUI DataGrid 分页

倖福魔咒の 提交于 2020-03-29 05:51:20
easyUI 自带了分页控件pagination, 那么在datagrid中只需要设置pagination:true即可。 datagrid分页如何与后台数据进行交互呢? datagrid设置分页后,会有两个参数传递到后台,在后台接受这两个参数,取出相应数据,返回到前端显示 page :当前第几页 rows :当前页显示多少条数据 当点击分页时,都会重新发送一次请求 并且后台需要返回total 表示一共有多少条数据,前端会接受它,算出{pages},{from},{to},{total}等一系列信息。 那么怎么设置下面分页工具条显示成中文呢? var p = $('#tb').datagrid('getPager'); $(p).pagination({ pageSize: 10,//每页显示的记录条数,默认为10 pageList: [5,10,15],//可以设置每页记录条数的列表 beforePageText: '第',//页数文本框前显示的汉字 afterPageText: '页 共 {pages} 页', displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录', onBeforeRefresh:function(){ $(this).pagination('loading'); alert('before refresh');

React封装强业务hook的一个例子

流过昼夜 提交于 2020-03-27 11:50:21
最近因为使用列表展示的需求有点多,就想着把列表分页筛选的逻辑抽象一下。看了umi的一个useTable的hook,也不能满足业务需要,于是就自己写了一个,支持本地分页筛选和接口分页筛选。 思路就是,筛选的字段都使用form表单控制,然后在hook里面将form和table联合起来。 下面贴出源码 1 import { TableProps, PaginationProps } from '@slardar/antd'; 2 import React, { useEffect } from 'react'; 3 import { 4 PaginationConfig, 5 SorterResult, 6 TableCurrentDataSource 7 } from 'antd/lib/table'; 8 import { useDeepCompareEffect } from '@byted-woody/slardar'; 9 10 export type WrappedFormUtils = any; 11 12 export interface TableControlState<T> extends TableProps<DataRow> { 13 pagination: PaginationProps; 14 sorter?: SorterResult<DataRow>;

vue分页组件

微笑、不失礼 提交于 2020-03-17 07:35:15
<template> <div> <ul class="pagination"> <li @click="goTo(1)"><a>首页</a></li> <li v-show="current != 1" @click="goTo(current-1)"><a>上一页</a></li> <li v-for="index in pages" @click="goTo(index)" :class="{'active':current == index}" :key="index"> <a>{{index}}</a> </li> <li v-show="allPage != current && allPage != 0 " @click="goTo(current+1)"><a>下一页</a></li> <li v-on:click="goTo(allPage)"><a>尾页</a></li> </ul> </div> </template> <script> export default { name: 'pagination', props: ['showItem','allPage'], computed: { pages() { var pag = []; if (this.current < this.showItem) { var i = Math.min(this

Yii2中自带分页类实现分页

不想你离开。 提交于 2020-03-13 11:00:07
1.首先写控制器层 先引用pagination类 use yii\data\Pagination; 写自己的方法: function actionFenye(){ $data = Field::find(); //Field为model层,在控制器刚开始use了field这个model,这儿可以直接写Field,开头大小写都可以,为了规范,我写的是大写 $pages = new Pagination(['totalCount' =>$data->count(), 'pageSize' => '2']); //实例化分页类,带上参数(总条数,每页显示条数) $model = $data->offset($pages->offset)->limit($pages->limit)->all(); return $this->renderPartial('fenye',[ 'model' => $model, 'pages' => $pages, ]); } 2. model层就是直接用../yii/frontend/web/index.php?r=gii 生成的model 3.最后是显示页面 <?php use yii\widgets\LinkPager; ?> <?php foreach($model as $key=>$val){ ?> <?= $val->Id; ?> //相当于

去哪儿-03-index-swiper

不羁岁月 提交于 2020-03-12 04:53:20
目标: 开发首页轮播图 创建一个分支 码云上创建一个名为index-swiper的分支,然后在项目目录下 git pull 将在线的分支拉到本地, git checkout index-swpier 转到当前分支,首页轮播图的开发将在这个分支进行。 轮播插件应用: 安装 : GitHub —>搜 vue-awesome-swiper —> 采用一个稍微老一点的稳定版本v2.6.7版本 —> npm install vue-awesome-swiper@2.6.7 --save —> 重启服务器 应用: 全局引入:在main.js中引入 import Vue from 'vue'和 import VueAwesomeSwiper from 'vue-awesome-swiper' 引入css样式:main.js中 import 'swiper/dist/css/swiper.css' 使用插件: 在main.js中使用 Vue.use(VueAwesomeSwiper, /* { default global options } */) 轮播图插件的初步使用 在components目录下创建Swiper.vue组件。 < template > < swiper :options = " swiperOption " > <!-- slides --> < swiper-slide >