diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index b217ab1a3d..316ab7007a 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -113,7 +113,11 @@ class etemplate_widget_nextmatch extends etemplate_widget $value = self::get_array(self::$request->content, $form_name, true); $value['start'] = 0; - $value['num_rows'] = self::INITIAL_ROWS; + if(!array_key_exists('num_rows',$value)) + { + $value['num_rows'] = self::INITIAL_ROWS; + } + $value['rows'] = array(); $send_value = $value; @@ -159,7 +163,10 @@ class etemplate_widget_nextmatch extends etemplate_widget $send_value['order'] = $send_value['sort']['id']; $send_value['sort'] = $send_value['sort']['asc'] ? 'ASC' : 'DESC'; } - $total = self::call_get_rows($send_value, $send_value['rows'], self::$request->readonlys); + if($value['num_rows'] != 0) + { + $total = self::call_get_rows($send_value, $send_value['rows'], self::$request->readonlys); + } $value =& self::get_array(self::$request->content, $form_name, true); // Add favorite here so app doesn't save it in the session diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index c4e2daac5c..4c165b30b0 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -1082,7 +1082,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], this.dataview.grid.setTotalCount(total); // Insert any data sent from server, so invalidate finds data already - if(this.options.settings.rows) + if(this.options.settings.rows && this.options.settings.num_rows) { this.controller.loadInitialData( this.options.settings.dataStorePrefix, @@ -1510,6 +1510,13 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], // Set filters to current values this.controller.setFilters(this.activeFilters); + // If no data was sent from the server, and num_rows is 0, the nm will be empty. + // This triggers a cache check. + if(!(this.options.settings.rows && this.options.settings.num_rows)) + { + this.controller.update(); + } + // Load the default sort order if (this.options.settings.order && this.options.settings.sort) {