Maximise results on load
This commit is contained in:
parent
0095b787b1
commit
0882d3f0da
|
@ -1,4 +1,3 @@
|
||||||
import ujson
|
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
@ -8,6 +7,7 @@ from math import floor, log10
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
import manticoresearch
|
import manticoresearch
|
||||||
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from siphashc import siphash
|
from siphashc import siphash
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,6 @@ $(document).ready(function(){
|
||||||
var show_table_content = function($table_class_container){
|
var show_table_content = function($table_class_container){
|
||||||
$table_class_container.find("#loader").hide();
|
$table_class_container.find("#loader").hide();
|
||||||
$table_class_container.find("#table-container").show();
|
$table_class_container.find("#table-container").show();
|
||||||
const event = new Event('restore-scroll');
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load buttons states for all button in page
|
// Load buttons states for all button in page
|
||||||
|
@ -240,5 +238,9 @@ $(document).ready(function(){
|
||||||
return $(this).data('td-class')
|
return $(this).data('td-class')
|
||||||
}).toArray();
|
}).toArray();
|
||||||
}
|
}
|
||||||
|
const event = new Event('restore-scroll');
|
||||||
|
document.dispatchEvent(event);
|
||||||
|
const event2 = new Event('load-widget-results');
|
||||||
|
document.dispatchEvent(event2);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -208,6 +208,9 @@
|
||||||
.grid-stack-item:hover .ui-resizable-handle {
|
.grid-stack-item:hover .ui-resizable-handle {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
|
.ui-resizable-handle {
|
||||||
|
z-index: 39 !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -75,10 +75,12 @@
|
||||||
var grid = GridStack.init({
|
var grid = GridStack.init({
|
||||||
cellHeight: 20,
|
cellHeight: 20,
|
||||||
cellWidth: 50,
|
cellWidth: 50,
|
||||||
|
cellHeightUnit: 'px',
|
||||||
auto: true,
|
auto: true,
|
||||||
float: true,
|
float: true,
|
||||||
draggable: {handle: '.panel-heading', scroll: false, appendTo: 'body'},
|
draggable: {handle: '.panel-heading', scroll: false, appendTo: 'body'},
|
||||||
removable: false,
|
removable: false,
|
||||||
|
animate: true,
|
||||||
});
|
});
|
||||||
// GridStack.init();
|
// GridStack.init();
|
||||||
setupTags();
|
setupTags();
|
||||||
|
@ -116,6 +118,25 @@
|
||||||
// re-create the HTMX JS listeners, otherwise HTMX won't work inside the grid
|
// re-create the HTMX JS listeners, otherwise HTMX won't work inside the grid
|
||||||
htmx.process(widgetelement);
|
htmx.process(widgetelement);
|
||||||
|
|
||||||
|
// update size when the widget is loaded
|
||||||
|
document.addEventListener('load-widget-results', function(evt) {
|
||||||
|
var added_widget = htmx.find(grid_element, '#drilldown-widget-results');
|
||||||
|
console.log(added_widget);
|
||||||
|
var itemContent = htmx.find(added_widget, ".control");
|
||||||
|
console.log(itemContent);
|
||||||
|
var scrollheight = itemContent.scrollHeight+80;
|
||||||
|
var verticalmargin = 0;
|
||||||
|
var cellheight = grid.opts.cellHeight;
|
||||||
|
var height = Math.ceil((scrollheight + verticalmargin) / (cellheight + verticalmargin));
|
||||||
|
var opts = {
|
||||||
|
h: height,
|
||||||
|
}
|
||||||
|
grid.update(
|
||||||
|
added_widget,
|
||||||
|
opts
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// run the JS scripts inside the added element again
|
// run the JS scripts inside the added element again
|
||||||
// for instance, this will fix the dropdown
|
// for instance, this will fix the dropdown
|
||||||
for (var i = 0; i < scripts.length; i++) {
|
for (var i = 0; i < scripts.length; i++) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block widget_options %}
|
{% block widget_options %}
|
||||||
gs-w="10" gs-h="30" gs-y="10" gs-x="1"
|
gs-w="10" gs-h="1" gs-y="10" gs-x="1"
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block heading %}
|
{% block heading %}
|
||||||
|
|
|
@ -32,6 +32,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
var widget_event = new Event('load-widget');
|
var widget_event = new Event('load-widget');
|
||||||
document.dispatchEvent(widget_event);
|
document.dispatchEvent(widget_event);
|
||||||
{% block custom_script_end %}
|
|
||||||
{% endblock %}
|
|
||||||
</script>
|
</script>
|
||||||
|
{% block custom_end %}
|
||||||
|
{% endblock %}
|
|
@ -1,7 +1,7 @@
|
||||||
import ujson
|
|
||||||
import urllib
|
import urllib
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
Loading…
Reference in New Issue