I have a power table using a stored procedure that has parameters fed by two date pickers. As those pickers change, the table refreshes. It’s not set to auto refresh. My pickers are also setup to get their initial date from a query as well, bound to their Date property. All usually works pretty well, it gives the user a starting range and then allows them to change it if they want.
The problem comes in when the screen loads. The power table initially loads it’s data based on the picker dates, then the pickers each update their date individually, which triggers the power table to load again (for each). So the table performs three queries on load instead of one.
And depending on when the screen was saved last, the initial date on the pickers could be pretty far back. So my screen today opened using date ranges:
9/1/2017 to 9/2/2017
then 9/1/20-17 to 5/17/2018 (when the end date picker updated)
and then finally 5/16/2018 to 5/17/2018 (when the start date picker updated)
In some cases, the start date updates first, which puts the start date after the end date and creates a very fast empty query. Nobody notices that. It’s when the end date fires first that we have issues.
So what i’m looking for is a way to prevent my table from updating it’s data until my date pickers are ready. I tried having the power table disabled, but that does not prevent it from updating it’s data. I have the method worked out to know when it’s time to update, I just can’t see a property or method to disable the data query.
My last resort is to modify my stored procedure and pass in the readiness and only query at the database level when ready, but that’s kinda cheesy.