-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load segment data asynchronously #963
Conversation
Segment QueryFilter can be quite complex and long to execute, this change allow to load the datagrid async, therefore allowing the page to load quickly
Hello @sadortun, Thank you for the improvement. The idea is great, but the solution needs to be enhanced:
Please consider of using https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/UIBundle/Resources/public/js/app/components/widget-component.js for rendering block with datagrid widget. It can be done with the help of
The goal is to initiate block widget when it is necessary and dispose it properly when it is time. |
@Grygir Understandable, this was only a prrof of concept :) ! |
@Grygir The goal of using an ajax request is to load the grid asynchronously, since in some case it can take up to a minute to load with very complex queries. Using I've found this example in the docs, but it seems outdated https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/UIBundle/Resources/doc/reference/widgets.md#interaction-example The closest i got to making it work was with the DialogWidget. If i use that component the datagrid displays inside the dialog, but no luck with the BlockWidget <div id="poll-widget"></div>
<script type="text/javascript">
require(['oroui/js/widget-manager', 'oro/block-widget', 'oro/dialog-widget'],
function(widgetManager, BlockWidget,DialogWidget ) {
var blockWidget= new BlockWidget({
title: 'test',
el: '#poll-widget',
url: '{{ path('oro_datagrid_widget', {gridName: gridName, params: params, renderParams : renderParams} ) }}',
});
blockWidget.render();
// widgetManager.addWidgetInstance(widgetInstance);
});
</script>` Am i missing something ? Thanks |
Ok, after some extensive digging, i noticed that the <div id="test-container"></div>
<script type="text/javascript">
require(['oroui/js/widget-manager', 'oro/block-widget', 'oro/dialog-widget'],
function(widgetManager, BlockWidget,DialogWidget ) {
var blockWidget = new BlockWidget({
title: 'test',
container: '#test-container',
url: '{{ path('oro_datagrid_widget', {gridName: gridName, params: params, renderParams : renderParams} ) }}',
});
blockWidget.render();
});
</script> This still show a full page loading spinner that prevent us from using the page, ill update this post if i find a solution. EDITSolution found, see PR code |
No inline js-code should be used, this approach is prohibited. You can find it only in some legacy code, that we are going to refactor. Expect, the following code should do the same
could you check? It should output empty |
To solve issue with blocking rendering, it is better to extend to resolve |
Segment QueryFilter can be quite complex and long to execute, this change allow to load the datagrid async, therefore allowing the page to load quickly
Require fix by #961
Related to #925
I am mostly sure that you wont merge this PR as is, but it give you a starting point to fix this issue