More ListView Results Per Page

sugarcrmdevelopers —  June 13, 2013

We recently implemented a highly customized listview-derived screen and didn’t want it to paginate. We’re extending the listview, so naturally the screen wants to limit the number of rows displayed to $GLOBALS[‘sugar_config’][‘list_max_entries_per_page’].

To override this variable for just this particular screen, I found the easiest thing to do was something like this:

<?php
class ViewMyCustomListView extends ViewList{
  public function display(){
    $true_list_max = $GLOBALS['sugar_config']['list_max_entries_per_page'];
    $GLOBALS['sugar_config']['list_max_entries_per_page'] = '10000';
    parent::display();
    $GLOBALS['sugar_config']['list_max_entries_per_page'] = $true_list_max;
  }
}

I found that using using 0 or -1 one didn’t work like I’d hoped, so the next idea is to just put the value to something unreasonably high. Note that this would cause the system to try to display 10,000 records on the screen if it found them (severe performance hit). We’re using this override in conjunction with a custom “where” clause that ensures only a few dozen records could show up at a given time, so I feel safe with this.