Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added optional labels #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions paper-datatable-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@
</div>
<div id="selectionToolbar" class="horizontal center layout fit" data-visible$="[[_selectedToolbarVisible]]">
<div class="flex selectionHeader">
<span>[[_numberselectedIds]]</span> item selected
<div hidden="{{!_singleSelectToolbarVisible}}">
<span>[[_numberselectedIds]]</span> [[labelItemSelected]]
</div>

<div hidden="{{!_multiSelectToolbarVisible}}">
<span>[[_numberselectedIds]]</span> [[labelItemsSelected]]
</div>
</div>
<div class="toolbar" data-visible$="{{_singleSelectToolbarVisible}}">
<content select="*[toolbar-select-single]"></content>
Expand All @@ -110,7 +116,7 @@
</div>
<div class="horizontal center layout" id="bottomBlock">
<div class="flex"></div>
<span>Rows per page:</span>
<span>[[labelRowsPerPage]]</span>
<paper-dropdown-menu no-label-float style="width: 68px;">
<paper-menu class="dropdown-content" selected="{{pageSize}}" attr-for-selected="value">
<paper-item value="5">5</paper-item>
Expand All @@ -120,7 +126,7 @@
</paper-menu>
</paper-dropdown-menu>
<span>
<span>[[_getRangeStart(page, pageSize)]]</span>-<span>[[_getRangeEnd(page, pageSize, numberOfItems)]]</span> of&nbsp;<span>[[numberOfItems]]</span>
<span>[[_getRangeStart(page, pageSize)]]</span>-<span>[[_getRangeEnd(page, pageSize, numberOfItems)]]</span> [[labelOfPages]]&nbsp;<span>[[numberOfItems]]</span>
</span>
<paper-icon-button icon="datatable:first-page" on-tap="firstPage" disabled="[[_prevPageDisabled(page)]]"></paper-icon-button>
<paper-icon-button icon="datatable:prev-page" on-tap="prevPage" disabled="[[_prevPageDisabled(page)]]"></paper-icon-button>
Expand Down Expand Up @@ -217,6 +223,42 @@
* @type Object
*/
header: String,
/**
* @attribute String
* @default 'Rows per page:'
* @type String
*/
labelRowsPerPage: {
type: String,
value: 'Rows per page:'
},
/**
* @attribute String
* @default 'Rows per page:'
* @type String
*/
labelItemSelected: {
type: String,
value: 'item selected'
},
/**
* @attribute String
* @default 'Rows per page:'
* @type String
*/
labelItemsSelected: {
type: String,
value: 'items selected'
},
/**
* @attribute String
* @default 'Label number "of" pages'
* @type String
*/
labelOfPages: {
type: String,
value: 'of'
},
/**
* See general documentation.
*
Expand Down Expand Up @@ -301,7 +343,7 @@
_selectedToolbarVisible: Boolean,
_singleSelectToolbarVisible: Boolean,
_multiSelectToolbarVisible: Boolean,
_numberselectedIds: Number
_numberselectedIds: Number,
},
ready: function(){
this._datatable = Polymer.dom(this).querySelector("paper-datatable");
Expand Down Expand Up @@ -530,6 +572,7 @@
this._singleSelectToolbarVisible = this.selectedIds.length == 1;
this._multiSelectToolbarVisible = this.selectedIds.length > 1;
this._numberselectedIds = this.selectedIds.length;

this._datatable._partialSelection = this.selectedIds.length > 0;
},
_setSelectedIds: function(ev){
Expand Down