summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/blocks/DataTables.html
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates/blocks/DataTables.html')
-rw-r--r--ishtar_common/templates/blocks/DataTables.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html
index f116d9573..135e2a51e 100644
--- a/ishtar_common/templates/blocks/DataTables.html
+++ b/ishtar_common/templates/blocks/DataTables.html
@@ -25,6 +25,9 @@
</div>
</div>
+{% if external_sources %}
+{% include "blocks/DataTables-external-sources.html" %}
+{% endif %}
{% if current_model.STATISTIC_MODALITIES or gallery or use_map %}
{% include "blocks/DataTables-tabs.html" %}
{% else %}
@@ -104,6 +107,15 @@ datatable_submit_search = function(not_submited){
datatable_{{sname}}.ajax.url(url);
datatable_{{sname}}.draw();
+{% if external_sources %}{% for source_id, source_label in external_sources %}
+ if (!not_submited){
+ url = "{{source}}?submited=1&" + data;
+ } else {
+ url = "{{source}}?" + data;
+ }
+ datatable_{{sname}}_{{source_id}}.ajax.url(url);
+ datatable_{{sname}}_{{source_id}}.draw();
+{% endfor %}{% endif %}
setTimeout( // wait for modal-progress to be loaded on the page
function(){
@@ -219,6 +231,34 @@ jQuery(document).ready(function(){
datatable_{{sname}}.on('deselect', dt_multi_enable_disable_submit_button);
{% endif %}
+{% if external_sources %}{% for source_id, source_label in external_sources %}
+ var base_external_source = "{{source}}";
+
+ if (default_search_vector){
+ base_source += "?search_vector=" + default_search_vector + "&submited=1";
+ }
+
+ datatable_options = {
+ "ajax": {
+ "url": base_external_source,
+ "dataSrc": function (json) {
+ if (!default_search_vector) manage_pinned_search("{{name}}", json);
+ update_submit_args();
+ setTimeout( // 50ms is waited on load so...
+ function(){
+ $('.modal-progress').modal('hide');
+ }, 500);
+ return json.rows;
+ }
+ },
+ "deferLoading": 0
+ };
+ $.extend(datatable_options, datatables_default);
+ if (datatables_i18n) datatable_options['language'] = datatables_i18n;
+ datatable_{{sname}}_{{source_id}} = jQuery("#grid_{{name}}_{{source_id}}").DataTable(datatable_options);
+
+{% endfor %}{% endif %}
+
{% if multiple %}
jQuery("#add_button_{{name}}").click(function (){
var mygrid = jQuery("#grid_{{name}}");