Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

List page .cacheAddMethod()

$
0
0

Does anyone know how to use .cacheAddMethod() on a list page?

Here is the scenario.

I have a field on a list page that is bound to a table data method, and that table data method is expensive (multiple records and database calls are made to arrive at the return value), and only required under certain circumstances (so the field should be hidden and thus the database and CPU cost avoided most of the time).

If I add the field to the list page grid bound to the table data method, I can make the field visible and hidden easily enough using this.listPage().listPageFieldVisible('controlname', false|true);.

I want caching on the table data method, to minimize the database and CPU cost when it is visible (as the list page is scrolled, etc.).  If the CachceDataMethod property of the field is left Auto or set Yes, that works fine and each record is only calculated once.  But, if the field is hidden from the list page interaction class initialized() method, the caching is still in effect, so the database and CPU cost still exists even though the field is now hidden.

So, I can set the CacheDataMethod property to No, and that works.  No further database and CPU cost when the field is hidden, but of course now no caching when it is visible.

I can access the FormDataSource object of the record within the list page interaction class.  If I try to do a .cacheAddMethod on that form data source in the .initialized() method, I get the following error.

"Method ‘CacheAddMethod’ can only be called after super() within the form datasource init method."

I'm not aware of any list page interaction methods that are tied to the form datasource .init() method, so I appear to be stuck.

Has anyone figured out a way to use .cacheAddMethod() from within a list page?


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>