KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Visual query builder Issue #2601

Open DVBI opened this topic on on Feb 28, 2022 - 8 comments

DVBI commented on Feb 28, 2022

Dropdown issue with the fields with visual query builder.

When the dropdown opens on the top side and you preform search on the fields the position of the dropdown is not correct.

Can you please help me with this?

Sebastian Morales commented on Mar 2, 2022

Can you pls run this example in a standalone report (not in your project/framework) and see if this issue remains.

If it doesn't there could be some element/javascript/css in your project that conflicts with VisualQuery's dropdown, which is BootstrapMultiSelect control. We will help you to solve the conflict.

If this happens even with a standalone example let us know. Tks,

DVBI commented on Mar 3, 2022

Above screenshot is from https://www.koolreport.com/examples/reports/visualquery/visualquery/ only and I have tried with standalone installation also the issue is same.

Sebastian Morales commented on Mar 3, 2022

We can't replicate this issue with the online example:

https://www.koolreport.com/examples/reports/visualquery/visualquery/

Would you pls let us know exactly how to reproduce it, i.e which browser you used, which actions you performed. Tks,

DVBI commented on Mar 4, 2022

I have emailed video to your support team to re-produce the issue and mentioned the Topic Link in the subject

Sebastian Morales commented on Mar 4, 2022

Thanks a lot for your effort with providing the problem reproducing steps. It looks like it happens when your browser window height from the select input to window bottom is too short for the dropdown to appear below the select input.

In such cases the dropdown would appear above the select input. Once appearing the dropdown position would not be changed until it is hidden and shown again even if its list of options is changed by filtering.

We can confirm it is the default behavior of the select control (Bootstrap multiselect). If you want to disable it and force the dropdown to always appear below pls add the following attribute to all button/link elements with class "dropdown-toggle" in your report page:

<button class="btn btn-secondary dropdown-toggle" data-flip="false" ...

Since VisualQuery hasn't had an option for this attribute, you can try to run a small script after it's ready on client side:

VisualQuery::create(array(
            ...
            "onReady" => "function() {
                // console.log('visualquery ready');
                document.querySelectorAll('.dropdown-toggle').forEach(function(btn) {
                    btn.setAttribute('data-flip', false);
                });
            }",
));

Hope this works for your case. Tks,

DVBI commented on Mar 4, 2022

Thank You! It worked.

DVBI commented on Mar 7, 2022

When you try to add more tables in above, The given solution didn't work for the newly added rows. Can you please help?

Sebastian Morales commented on Mar 8, 2022

Oh, I see your point. When a new select control is added we need to set its data-flip attribute as well. Pls try the following not perfect solution:

    VisualQuery::create(array(
            "name" => "visualquery1",
            ...
            "onReady" => "function() { // assuming visualquery1 is your VisualQuery name, otherwise replace it below
                console.log('visualquery ready');
                document.querySelectorAll('krwidget[widget-name=\"visualquery1\"] .dropdown-toggle').forEach(function(btn) {
                    btn.setAttribute('data-flip', false);
                });
                var addTableBtn = document.querySelector('#visualquery1-Tables button');
                addTableBtn.addEventListener('click', function() {
                    setTimeout(function() {
                        document.querySelectorAll('krwidget[widget-name=\"visualquery1\"] .dropdown-toggle').forEach(function(btn) {
                            btn.setAttribute('data-flip', false);
                        });
                    }, 500); // wait 0.5 second after multiselect is added to set its data-flip attribute
                });
            }" 

In the future versions of VisualQuery we will add more events for users to have more customization. Rgds,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None