HTML reports shows only first 30 records of a relationship
Archived from the Xataface Users forum.
patrei — Sat Mar 02, 2013 3:49 am
Hi all.
I’am using the new htmlreports module and noticed that when I map a relationship to an html table, only the first 30 records are fetched and shown in the table.
This happens both in preview and in record_action.
Setting default_limit=500 in conf.ini does not solve the problem.
Is there some implicit limit to the number of related records retrieved by htmlreports? How can this limit be changed?
Thanks
(Xataface 1.9 3856)
shannah — Sat Mar 02, 2013 1:29 pm
Yes.. This is a bit of a shortcoming right now. The related lists in reports calls getRelatedRecordObjects() which only loads the first “page” of related record results - which is default 30 per page.
You can use the Dataface_Table::setRelationshipRange() method to adjust this default value. A good place to do this would be in the table’s init() method of its delegate class as it is called once per request just when the table is first loaded.
e.g.
- Code: Select all
function init(Dataface_Table $table){ $table->setRelationshipRange('myrelationship', 0, 100); }
Alternatively, you could modify the classes/XfHtmlReportBuilder.class.php class and look for all invocations of getRelatedRecordObjects() (there are 3), and add a 2nd parameter ‘all’ to them. E.g.
- Code: Select all
$record->getRelatedRecordObjects($relname, 'all');
That will force it to load all related records instead of just the first 30.
-Steve
patrei — Sun Mar 03, 2013 8:09 am
Thank you Steve for your quick reply.
I modified XfHtmlReportBuilder.class.php as you suggested and everything is ok now.
By the way, Xataface is great!
Patrick