我想自定义 mat-paginator 。默认情况下,我得到这样的分页器,它在下面的链接https://material.angular.io/components/paginator/overview 中给出 。但我想要如下图所示的分页。我如何使用mat-paginator做到这一点
任何人都可以帮我解决这个问题。
我有一个Django-CMS插件,用于显示对象列表.插件所需的功能是列表是分页的,可以根据列表中对象的属性重新排序.
在这种特殊情况下使用ajax处理这个功能并不是一个理想的解决方案,因此我计划使用django Paginator,它需要一个'page'查询字符串参数,并传递一个'order'查询字符串参数,我将用它来定义顺序查询集.
问题是我无法看到从插件渲染功能中访问请求对象.
有谁知道是否可以从渲染功能中访问请求对象,或者可以建议一个解决方法?
在cakephp视图中使用paginator helper时,它不会记住为我的useage定制的url部分.
例如:
http://example.org/users/index/moderators/page:2/sort:name/dir:asc
Run Code Online (Sandbox Code Playgroud)
这里的主持人是一个帮助我按该类型过滤的参数.但是按下分页器链接将不包括此链接.
我正在一个拥有MySQL innodb后端的django网站上工作.我们在几个表中有数十万条记录,这导致了管理员的一些站点稳定性/性能问题.具体来说,django喜欢在创建分页器时进行count(*)查询,这会导致很多问题.
使用Django 1.3.x,他们开始允许提供自定义分页类.所以,我有兴趣找到一种方法来适当加快或消除这些查询.到目前为止,我一直在查看这两个页面:http ://code.google.com/p/django-pagination/source/browse/trunk/pagination/paginator.py https://gist.github.com/ 1094682 并没有真正发现它们是我正在寻找的.任何建议,帮助等.非常感谢.
我正面临一个问题.我已经编写了分页代码.一切都按预期工作,但只有条件不起作用(只有特定条件)这是我的分页代码.
//declaration
public $paginate = array(
'limit' => 50,
'paramType' => 'querystring'
);
//use in action
$this->paginate['ApiLog'] = array('limit' => 50, 'order' => 'ApiLog.id DESC', 'paramType' => 'querystring');
$this->paginate['ApiLog']['conditions'] = array('ApiLog.log_type' => 2);
$this->paginate['ApiLog']['joins'] = array(
array(
'table' => 'users',
'alias' => 'User',
'type' => 'LEFT',
'conditions' => array('User.id = ApiLog.user_id')
)
);
$this->Paginator->settings = $this->paginate['ApiLog'];
$apilogs = $this->Paginator->paginate('ApiLog');
Run Code Online (Sandbox Code Playgroud)
此代码在开发环境中工作并且返回类型为2的日志,但在生产中它只返回类型为1的日志.我花了一整天时间来找出问题.如果我确实添加任何其他条件conditions array
确实生效但不生效log_type
.我打印查询日志,where clause
总是显示log_type = '1'
我已经清除了缓存.任何帮助表示感谢,谢谢.
我有一个模型formset,我想使用Django的Paginator一次显示10个表单,但它不能像paginator = Paginator(formset, 10)
.如果有办法,这样做的正确方法是什么?
我有两个模型用户和角色
这里"Roles hasMany Users"和"Users areTo Roles"
当用户保存时,我们还要求保存用户的角色和记录.
问题: 我有列firstname,lastname,roles的用户列表.每个列和每个列都有排序,但角色排序不起作用.
角色表包含角色名称的"名称"字段.我在下面提到了链接,但它对我不起作用. Pagination在Cakephp 3.x中排序
UsersController:
public function index() {
$this->paginate = [
'contain' => ['Roles'],
'conditions' => [
'Users.user_type <>' => 1
]
];
$this->set('users', $this->paginate($this->Users));
$this->set('_serialize', ['users']);
}
Run Code Online (Sandbox Code Playgroud)
index.ctp
<tr>
<th><?php echo $this->Paginator->sort('firstname',__('First Name')) ?></th>
<th><?php echo $this->Paginator->sort('lastname',__('Last Name')) ?></th>
<th><?php echo $this->Paginator->sort('email',__('Email Address')) ?></th>
<th><?php echo $this->Paginator->sort('Roles.name',__('Role Associated')) ?></th>
<th><?php echo $this->Paginator->sort('status',__('status')) ?></th>
<th class="actions"><?php echo __('action') ?></th>
</tr>
Run Code Online (Sandbox Code Playgroud)
让我知道你有任何解决方案.
我有一个带有 mat-table 和 mat-paginator 的 angular 项目,类似于以下内容:
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef mat-sort-header> ID </th>
<td mat-cell *matCellDef="let row"> {{row.id}} </td>
</ng-container>
<ng-container matColumnDef="progress">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Progress </th>
<td mat-cell *matCellDef="let row"> {{row.progress}}% </td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
<td mat-cell *matCellDef="let row"> {{row.name}} </td>
</ng-container>
<ng-container matColumnDef="color">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Color </th>
<td mat-cell *matCellDef="let row" [style.color]="row.color"> {{row.color}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let …
Run Code Online (Sandbox Code Playgroud) 当我特别点击mat-paginator 最后一个按钮时,我需要听。有没有事件侦听器或方法可以做到这一点?
我尝试过:(page)="pageEvent = $event;emitPagination($event)"
但它没有返回有关我点击位置的信息。
和同样的(click) = event($event)
HTML:
<mat-paginator #paginator
[length]="totalElements"
[pageSize]="5"
[showFirstLastButtons]="true"
(page)="pageEvent = $event;emitPagination($event)">
</mat-paginator>
Run Code Online (Sandbox Code Playgroud)
我希望在单击最后一个按钮时调用特定方法。
paginator ×10
cakephp ×3
django ×3
pagination ×3
angular ×2
admin ×1
angular5 ×1
angular7 ×1
cakephp-2.0 ×1
cakephp-3.0 ×1
django-cms ×1
formsets ×1
php ×1
plugins ×1
python ×1
request ×1
sorting ×1
virtual ×1