I am currently working on an application where the Extension preside-ext-better-view-record-screen is being used. One of the tabs is used to display related records of another object:
The view will then show the correct object, but, it will not filter the result, all records are shown.
I played around a bit and noticed that changing the filterContextData attribute does not seem to change anything, neither in the tab that works correctly, nor in the new tab.
Any idea what might be going on here? Am I missing something?
Rather than render the view, I’d recommend using the helper method which calls the handler method to render the datatable, and also runs any datamanager customisations you may have in place. e.g.:
thanks for your reply, but, it still returns all records. I did some more tests and found
if I use a non existent field like filterContextData ={ nonExisting=args.record.id } no error is thrown
with the other tab, if I use filterContextData ={ nonExisting=args.record.id } or even remove the it all together, it still shows only the related records
I just looked at the debug info and the query to select the “sponsorenseite” object indeed uses the related property “eventId” and returns only related records (but apparently that query is not used for listing the records in objectDataTable)
I removed the first tab (object “vortrag”), but that doesn’t change the behaviour of the problematic tab
Another thing:
I added another property for the relation to “sponsorenseite”. This property has the same name as the related object “veranstaltung” and I changed filtering accordingly: filterContextData = { veranstaltung=args.record.id }
This filter is not showing up in the debug info, so it seems, it is not used at all.
So I finally solved this. I had to add the customizations getAdditionalQueryStringForBuildAjaxListingLink() and preFetchRecordsForGridListing() to the handler.
In getAdditionalQueryStringForBuildAjaxListingLink()I make sure that the ID of the parent object is passed along in the Ajax datasource URL and in preFetchRecordsForGridListing() I create an extra filter for the grid listing if that ID is present.