Skip to content

Commit 488b86d

Browse files
committed
MAGETWO-52360: Create template with detailed paging information
1 parent 95abd47 commit 488b86d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

app/code/Magento/Ui/view/base/web/js/grid/paging/paging.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ define([
110110
return this;
111111
},
112112

113+
/**
114+
* Gets first item index on current page.
115+
*
116+
* @returns {Number}
117+
*/
118+
getFirstItemIndex: function () {
119+
return this.pageSize * (this.current - 1) + 1;
120+
},
121+
122+
/**
123+
* Gets last item index on current page.
124+
*
125+
* @returns {Number}
126+
*/
127+
getLastItemIndex: function () {
128+
var lastItem = this.getFirstItemIndex() + this.pageSize - 1;
129+
130+
return this.totalRecords < lastItem ? this.totalRecords : lastItem;
131+
},
132+
113133
/**
114134
* Sets cursor to the provied value.
115135
*
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!--
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div class="admin__control-support-text">
8+
<!-- ko if: totalRecords -->
9+
<strong>
10+
<text args="getFirstItemIndex()"/> -
11+
<text args="getLastItemIndex()"/>
12+
</strong>
13+
<!-- ko i18n: 'of' --><!-- /ko -->
14+
<!-- /ko -->
15+
<strong text="totalRecords"/>
16+
<!-- ko i18n: 'records found' --><!-- /ko -->
17+
<!-- ko if: totalSelected -->
18+
(<text args="totalSelected"/> <!-- ko i18n: 'selected' --><!-- /ko -->)
19+
<!-- /ko -->
20+
</div>

0 commit comments

Comments
 (0)