Embedded list shows no records

Hi!
I have an application with several models.
Some of these models have an embedded list showing a relationship with other entities. The problem is that sometimes, not always, when I enter the form, the embedded lists appears empty. Only when I click the "Add xxx" button it refreshes the list, showing the previously related items.
I don't know if this can help but the form fields are in different tabs.
Sometimes the embedded lists show empty and sometimes they show their records correctly.

Any help?
Thanks!!!

Jaime

Comments

  • Anyone can tell me how to force refresh the embedded list after loading the form? Pleeeease :)

  • Hi weblar,

    Are there any errors that are displaying in the console. The embedded list view does trigger an event when it's complete on the document object that you can listen to. If you add the following field it should console.log to your browser when a tab is clicked as well as when the table is done loading:
    ```
    $fields['test'] = array('type' => 'custom', 'value' => '', 'js' => '

    $(document).on("tabClicked", "#fuel_form_tabs ul", function(e){ console.log('Tab clicked'); }) $(document).on("refreshEmbedListComplete", ".locations", function(){ console.log('Embedded list complete'); });

    ');
    ``

  • edited October 2019

    Many thanks, admin.
    I tried your suggestion with no clues about what was going wrong.
    Testing...

  • edited October 2019

    Also, when I delete one of the embedded list items, the item still appears in the list when I refresh the page.
    I have to open the "Add xx" modal and close it again to refresh the list.
    Then I refresh the page and the item is there again.
    Same behaviour when I add and item.
    Maybe a problem with OPCache or any other caché system?

  • ... and it's running on Ngnix.

  • Are you able to see in the console AJAX requests when deleting a record (it should be using AJAX to refresh that area).

  • I can see that on AJAX refresh, but not on page load/refresh.
    When I load/refresh the page I "sometimes" get a previous state of the embedded list, except when it loads after saving the main form.
    When loading the list via AJAX, it loads the correct items.
    Does it make any sense? I'm very confused.

  • On load it does AJAX... only on updates. Does it sound like you are seeing a cached version of older data? If you check the database, is the data updated?

  • That's exactly what it seems. Data is updated in the data base but the refresh of the page show the previous version of the data set.
    I tried to avoid any server and client caché with no result.
    Any clue?

  • You mind testing something out on your end? Line 1485 in the custom_fields.js file to add a cache breaking query string parameter (timestamp) to the AJAX call:

    var embeddedListAjax = $.post(__FUEL_PATH__ + "/" + $activeEmbeddedList.data("module-url") + "/ajax/embedded_list_items?c=" + new Date().getTime(), $activeEmbeddedList.data("embedded-list-params"));
    
  • edited October 2019

    Your suggestion didn't help either, because... everything was OK on the Fuel side.
    Finally, the server team gave me access to an Adminer to access the database. So it was easy to see that the data wasn't updating in realtime on the database. So I urge them to solve the configuration problem and they told me they had to change the NGNIX Fast CGI config. 🤦🏽‍♂️
    Now everything is working fine!
    Sorry for all the inconvenience!
    And thank you very much for the help!!!

    Jaime

  • Interesting. Thanks for the update.

Sign In or Register to comment.