Sha256: 75d90107276dbf8494adfba175d0a711e3e65d125a3b80e897f5fc246de0d225
Contents?: true
Size: 1.07 KB
Versions: 57
Compression:
Stored size: 1.07 KB
Contents
$.fn.alchemyPageSelect = function (options) { var pageTemplate = HandlebarsTemplates.page return this.select2({ placeholder: options.placeholder, allowClear: options.hasOwnProperty("allowClear") ? options.allowClear : true, minimumInputLength: 3, initSelection: function (_$el, callback) { if (options.initialSelection) { callback(options.initialSelection) } }, ajax: { url: options.url, datatype: "json", quietMillis: 300, data: function (term, page) { return { q: $.extend( { name_cont: term }, options.query_params ), page: page } }, results: function (data) { var meta = data.meta return { results: data.pages, more: meta.page * meta.per_page < meta.total_count } } }, formatSelection: function (page) { return page.text || page.name }, formatResult: function (page) { return pageTemplate({ page: page }) } }) }
Version data entries
57 entries across 57 versions & 1 rubygems