-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 8225-link-selected
- Loading branch information
Showing
4 changed files
with
129 additions
and
7 deletions.
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
app/views/components/datagrid/test-show-and-hide-pager.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<div class="row"> | ||
<div class="six columns"> | ||
<h2>Datagrid Test: Hide and Show Pager</h2> | ||
<br /> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="six columns"> | ||
<div class="field"> | ||
<button id="hide-pager" class="btn-primary"> | ||
<span>Hides the pager bar</span> | ||
</button> | ||
|
||
<button id="show-pager" class="btn-secondary"> | ||
<span>Shows the pager bar</span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="twelve columns"> | ||
<div class="toolbar"> | ||
<div class="title"> | ||
| ||
</div> | ||
<div class="buttonset"></div> | ||
<div class="more"> | ||
<button class="btn-actions" type="button"> | ||
<svg class="icon" focusable="false" aria-hidden="true" role="presentation"> | ||
<use href="#icon-more"></use> | ||
</svg> | ||
<span class="audible">More Actions</span> | ||
</button> | ||
<ul class="popupmenu"> | ||
<li><a href="#">Option One</a></li> | ||
<li><a href="#">Option Two</a></li> | ||
<li><a href="#">Option Three</a></li> | ||
<li class="separator single-selectable-section"></li> | ||
<li class="heading">Row Height</li> | ||
<li class="is-selectable"><a data-option="row-extra-small" href="#" data-translate="text">ExtraSmall</a></li> | ||
<li class="is-selectable"><a data-option="row-small" href="#" data-translate="text">Small</a></li> | ||
<li class="is-selectable"><a data-option="row-medium" href="#" data-translate="text">Medium</a></li> | ||
<li class="is-selectable is-checked"><a data-option="row-large" href="#" data-translate="text">Large</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div id="datagrid"></div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
$('body').one('initialized', function () { | ||
var columns = [], | ||
data = []; | ||
|
||
//Define Columns for the Grid. | ||
columns.push({ id: 'id', name: 'Id', field: 'id', formatter: Soho.Formatters.Readonly}); | ||
columns.push({ id: 'productId', name: 'Product Id', field: 'productId', width: 140, formatter: Soho.Formatters.Readonly}); | ||
columns.push({ id: 'productName', name: 'Product Name', sortable: false, field: 'productName', width: 150, formatter: Soho.Formatters.Hyperlink}); | ||
columns.push({ id: 'activity', hidden: true, name: 'Activity', field: 'activity', width: 125}); | ||
columns.push({ id: 'quantity', name: 'Quantity', field: 'quantity', width: 125}); | ||
columns.push({ id: 'price', name: 'Price', field: 'price', width: 125, formatter: Soho.Formatters.Decimal}); | ||
columns.push({ id: 'orderDate', name: 'Order Date', field: 'orderDate', formatter: Soho.Formatters.Date, dateFormat: 'M/d/yyyy'}); | ||
|
||
function gridSource(req, done) { | ||
var url = '{{basepath}}api/compressors?pageNum='+ req.activePage +'&pageSize='+ req.pagesize; | ||
|
||
return $.getJSON(url, function(res) { | ||
req.total = res.total; | ||
done(res.data, req); | ||
}); | ||
} | ||
|
||
//Init and get the api for the grid | ||
gridApi = $('#datagrid').datagrid({ | ||
columns: columns, | ||
selectable: 'multiple', | ||
paging: true, | ||
pagesize: 5, | ||
source: gridSource, | ||
toolbar: { | ||
title: 'Data Grid Header Title', | ||
results: true, | ||
dateFilter: false, | ||
keywordFilter: true, | ||
advancedFilter: true, | ||
actions: true, | ||
views: true, | ||
rowHeight: true, | ||
collapsibleFilter: true | ||
} | ||
}).data('datagrid'); | ||
|
||
|
||
$('#hide-pager').on('click', function() { | ||
gridApi.pagerAPI.hidePager(); // Calling the hidePager method to hide the pager. | ||
}); | ||
|
||
$('#show-pager').on('click', function() { | ||
gridApi.pagerAPI.showPager(); // Calling the showPager method to show the pager. | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters