SearchBuilder improperly displaying indented criteria on loaded state?
SearchBuilder improperly displaying indented criteria on loaded state?

Links
Test case: https://jsfiddle.net/a1vczxft/1/
(Basically identical to this example, except the one above uses the modal rather than the embedded version)
https://datatables.net/extensions/staterestore/examples/integration/searchBuilder.html
Example
Steps to reproduce:
1. Open searchBuilder, add 2 criteria, and indent both of them.
2. Create a state once applied, then reload that state (doesn't even need a table reload)
When loading you can see the indented buttons on the left, it seems the CSS just isn't set correctly:
This doesn't seem to be a savedState issue in the sense of the data not storing correctly, because the localStorage holds the data as expected.
Also if you add a criteria at the bottom (while within the broken state) and remove it, it rebuilds it correctly.
Answers
Alright I believe I've diagnosed the issue, may not be the best solution but it's a solution.
Below are the modified methods:
SearchBuilder main method
State Load Params handler
SearchBuilder button extension action
Explanation
The issue is when the searchBuilder is shown as a popover and loadState is leveraged. Specifically the following portion within the setupLogic:
Since the container is not visible, the browser has not rendered or calculated the dimensions.Solution
When the popover is truly rendered in the dom for the first time, redraw all the content, at this point the dom will be calculated correctly. This is only necessary for the first time, since any modification to the searchBuilder while the popover is visible will rebuild as expected. The flag prevents unnecessary rebuilds for better performance.
Hi,
Many thanks for posting back on this, and sorry I wasn't able to reply before. Thank you for digging into the issue - I'll look into when I'm next rooting around in the SearchBuilder code
Allan