Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
RecordLoadMode getting stuck on PreLoadRecords (maybe)
posted

OK, so here's the situation: I'm using v10 of the WPF XamGrid and I'm doing a very simple thing -

1. Execute a query to fill up a datatable

2. Set the grid's DataSource to the table's defautl view

Then, if I need to do a new query, I create a new table, and do the following:

 

XamGrid.FieldLayouts.Clear();

XamGrid.DataSource =

null;

XamGrid.DataSource = sourceData.DefaultView;

 

Voila!  New results.  And everything is working lickety-split because it's loading records on demand.

Now here's where it get's interesting: if I click on a column header to sort a particular result set, it obviously goes out and loads all the rows so that it can sort them.  Now, I change the query to populate the grid and suddenly, the new query takes a lot longer to run.  The reason?  Becuase it's now preloading all the records instead of doing load on demand.

I've checked and the RecordLoadMode is still showing as on demand, but it's acting like there's a client sort in place and overriding that.  I've tried using ClearCustomizations to clear all customizations, but that hasn't helped.

Any ideas about what property would I need to set (or method I need to call) to prevent this behavior when I clear the current layout and reset the underlying data source?

  • 210
    Verified Answer
    posted

    OK, you've got to love when someone immediately turns around and answers their own question.

    Turns out I was clearing the customizations after clearing the field layout and setting the datasource to null.  But if I do ClearCustomizations(CustomizationType.All) as the first thing, then it works properly and reverts back to loading on demand when the new query executes.

    So never mind, but thanks anyway!