I recently updated from 7.x-3.5 to 7.x-3.7 and now the ajax response no longer contains total_results. I was using this in some custom javascript, but now it is unavailable and I don't think this information can be found elsewhere in the response.

I also think it was accidentally removed in 34d15bca464a4708a53bac9746865a37e9f77259 which says it is part of #2700063: Add "Apply" button that will apply all filters in one query but none of the patches in that issue show removing total_results, and from what I could tell was not discussed as to why that would be necessary.

Comments

jojonaloha created an issue. See original summary.

jojonaloha’s picture

Issue summary: View changes
jojonaloha’s picture

Status: Active » Needs review
StatusFileSize
new4.65 KB

Attached patch adds back the total_results and update_results to the api response. It also adds the Drupal.ajax_facets.showTooltip javascript function and call. I haven't fully tested the javascript as our custom javascript overrides some of that, but I am not getting any javascript warnings.

eugene.ilyin’s picture

Hello

I thought that this functionality is useless and I removed it. But seems people need it.
I returned it back, but with some corrections.
Now there is no setting "Update results". Instead of it, the tooltip will be displayed when the block with ajax facets buttons is available on the current page. Because when this block is active, then search results will not be updated until the user will click "Submit button". And makes sense to show the tooltip with a total count of found items.

  • eugene.ilyin committed 6affb51 on 7.x-3.x
    aIssue #2912825 by jojonaloha, eugene.ilyin: Total Results removed from...
eugene.ilyin’s picture

Done.

eugene.ilyin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

narkoff’s picture

I do not understand why, but this commit - specifically this chunk - causes range sliders widget to break with error Uncaught ReferenceError: $this is not defined at Object.Drupal.ajax_facets.processSlider.

@@ -380,7 +389,7 @@
     Drupal.ajax_facets.sendAjaxQuery({
       pushStateNeeded: !Drupal.ajax_facets.ajax_facets_buttons,
       searchResultsNeeded: !Drupal.ajax_facets.ajax_facets_buttons
-    });
+    }, $this);
   };

Reverting just this chunk fixes issue.