1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Using list div template with ajax nav no longer display anything after filtering up to an empty list

Discussion in 'Community' started by lcollong, May 8, 2019.

  1. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Hi,

    Pretty easy to simulate. Including on the back-end using regular isis template. Tested on a recently updated site. My test case :
    list set with ajax nav, filter above, on change, layout (admin) --> div
    2 additional regular elements with filter (dropdown) set.
    Filling in 2 records with different data.
    Displaying the list in the back-end
    filtering once --> 1 record
    filtering twice in order to be sure to not find any data -> no records shown.

    1/ the empty data message 'no records' does not show up
    2/ you cannot revert to display any data (clear filters) until you refresh the whole page.

    Does not occur with the standard bootstrap template.

    It seems that list.js remove the main fabrikContainer and no longer draw it back for the next fetch ?...

    Thanks for testing and confirm
     
  2. startpoint

    startpoint Active Member

    Level: Community
    I have the second problem too - you cannot revert to display any data (clear filters) until you refresh the whole page, but in frontend view with standard protostar template.
     
  3. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Thanks for testing.
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    Fabrik3.9 or recent GitHub?
     
  5. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    J 3.9.5, F3.9 github updated on Feb, 2nd this year
     
  6. startpoint

    startpoint Active Member

    Level: Community
    My installation is with latest github update.
     
  7. troester

    troester Well-Known Member Staff Member

    Level: Community
    Hmm, I can see this, too.
    But it's in frontend AND backend.
    And it's also with the bootstrap template if Fabrik list caching is not disabled (in list settings, Joomla caching is OFF anyway).
     
  8. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Hugh ?

    Did you have some time to take a look to this one ?
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Nope. Hoping to get to it today or tomorrow.

    -- hugh
     
  10. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    NEEDS TESTING!

    OK, I resolved the OP problem, but that raised another problem, which required a bit of a hacky solution.

    The first problem was that the "empty row template" was not being handled properly in the JS. That's the blank row we generate in the list view and pass to the list JS as an option, for use with AJAX enabled lists, either when the list loads with no rows (like with "required filters"), or after AJAX filtering empties out all the rows. Because the AJAX filter response is just a JSON array of element data, not a rendered row template, we need that blank template to insert the individual element data into.

    But that then uncovered another problem, which is that div templates have that extra row wrapper ... ie. they have multiple list data "rows" (using a Bootstrap grid) per rendered view "row", rather than the simple "one row of rendered data per table row" in the standard template. And as we generate the "empty row template" from the template's default_row.php, that extra grid wrapper was not there ... in the div template, it's handled in default.php, after we've iterated round and built an array of all the row templates with default_row.php.

    So I had to add an extra template file to the div template folder, 'default_empty_row.php', which generates the single empty default_row template, then wraps that in the Bootstrap grid. Then removes the outer 'row-fluid' div that our Html::grid() helper wraps grids in. So when generating the empty row template, the view code now checks to see if default_empty_row.php exists, and if so uses that instead of default_row.php.

    I'm about to commit the changes, would appreciate some testing for both div and non-div templates, on front and back end, with and without AJAX.

    -- hugh
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
  12. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    Sounds clear. It's a bit late now, here in south of France but I'll check it tomorrow :)
    Thanks
     
  13. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Out of interest, did this ever work for div templates? I'm struggling to see how it could ever have worked, with AJAX enabled, with a div template, once the list was empty.

    Hugh
     
  14. startpoint

    startpoint Active Member

    Level: Community
    @cheesegrits I have this problem namely when using div template with Ajax enabled.
     
  15. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    On the front end it works like a charm (which, indeed, was the main issue). However the "empty table" message does not show.
    On the back end, it shows back values without any templating after clearing filters following a 0 rows result.

    I've only used the div template on few sites and not recently until the current site I'm working on. As far as I remember, only used "div" template in non-ajax mode. And if so, never noticed the problem before. So could not say.
     

    Attached Files:

  16. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
  17. startpoint

    startpoint Active Member

    Level: Community
  18. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    @Hugh : well done !
    @startpoint : I do not have flash enable on my machine. Do you mean it works or not for you ?
     
  19. troester

    troester Well-Known Member Staff Member

    Level: Community
    Old IE11 is still running flash (I think; maybe I had it enabled there some time ago just for testing);)
    @startpoint : Did you clear all browser cache?
    Clearing filter is working in frontend and backend on my site.
    "No data" is still missing.

    But I have a strange behaviour with "show labels"=yes ( not related to the last commits, it's also with older ones):
    The labels are showing shortly, then they are overridden with the element content.
     
  20. startpoint

    startpoint Active Member

    Level: Community
    @troester : everything work properly after I updated again.
    Maybe something was wrong first.
    Works normally on frontend and backend.
    except "No data" is still missing.
    @cheesegrits : Thank you for your support.
     

Share This Page