$.listings('bindListingsHandlers')
$('#listings-container').listings('bindListingsHandlers')
$('#listings-container') targets the element containing the listings. #listings-container is the most common element for this, but any appropriate selector can be specified.
- Inline edits:
.inline-edit-cell double-click
- Pagination & paging button handlers (
.page-btn)
- Update cache:
.update-cache-btn click
- Delete records:
.trash-btn click
- Makes button icons for the following elements:
.details-btn, .preview-btn, .edit-btn, .print-btn, .update-cache-btn, .trash-btn.
- Button element handlers should persist after listings content is refreshed.
$.listings('bindListingsHandlers') in turn calles $.listings('bindListingsButtons'). The two routines are separated so $.listings('bindListingsHandlers') doesn't need to be called multiple times to avoid attaching duplicate handlers to listings elements.
- This routine does not refresh the handlers or buttons after the listings are refreshed. This can be achieved with
$(document).ready(function() {
$('#listings-container').listings('bindListingsHandlers');
LITTLED.init({setSortables: function() {
$('#listings-container').listings('bindListingsButtons');
}
});
});
Content CMS
- Specify a listings handler script with the "listings uri" setting.
- Default handler is
/hostmgr/_ajax/utils/listings.php
- Default handler requires that the content and filters objects for that type of content have been defined within the local
cache_class.
HTML
<table id="listings-table" data-tid="<?=$filters->site_section->id->value?>" data-p="<?=$filters->calc_rec_position()?>">
- The listings container is a table.
- Attributes of
table element:
id default value #listings-table. Used as jQuery selector for paging functionality.
data-tid content type contained within table. Used to retrieve paging content.
data-p Index of the first record on the page. E.g. on the 2nd page with 50 records per page the value would be 51.
PHP
include (COMMON_TEMPLATE_DIR."framework/navigation/listings_page_links.php");
- This include is placed outside the
table id="listings-table"element and inside the div id="listings-container" element.
JavaScript/jQuery/AJAX
$.keywords('bindListingsHandlers')
$('#listings-container').keywords('bindListingsHandlers')
#listings-container targets the element containing the listings. It's the most common element to use in this case, but any appropriate selector may be used.
- Loading inline editor:
.edit-kw-btn click
- Submitting and canceling inline edits:
.kw-commit-btn and .kw-cancel-btn click
- Button icons:
.ui-icon-edit
$.keywords('bindListingsHandlers') in turn calles $.keywords('bindListingsButtons'). The two routines are separated so $.keywords('bindListingsHandlers') doesn't need to be called multiple times to avoid attaching duplicate handlers to listings elements.
- Button element handlers should persist after listings content is refreshed.
- The routine doesn't handle refreshing the button elements when the listings content is refreshed.
Keyword filter autocomplete
$(selector).galleries('keywordAutocomplete')
Datepicker
$('.datepicker').datepicker();
See Also