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
3305
Cannot seem to retain Entered Filter values on a page reload , even though the actual filters are still in place
posted

Everything seems to be working correctly but the actual entered values in the filters are eluding me. Our Design team would like those values to still be in the filter textboxes on a reload.

Here is how I am handling this issue so far (and all seems to be working except for the entered values. We are still on 12.1)

Version # 12.1.20121.2068

 

    private void OnUnloaded(object sender, RoutedEventArgs args) {

      XamGrid grid = sender as XamGrid;

      if (grid != null) {

        if (_viewModel != null) {

          _viewModel.Filters = grid.FilteringSettings.RowFiltersCollection;

          PersistenceSettings settings = PersistenceManager.GetSettings(grid);

          MemoryStream stream = PersistenceManager.Save(grid, settings);

          _viewModel.GridSettings = stream.ToArray();

        }

      }

    }

 

The actual settings I am interested in preserving are specified on the XAML.  When I added these I was able to reduce the size of the setting byte array considerably.

 

    <ig:PersistenceManager.Settings>
        <ig:PersistenceSettings SavePersistenceOptions="OnlySpecified">
            <ig:PersistenceSettings.PropertySettings>
                <ig:PropertyNamePersistenceInfo PropertyName="FilteringSettings"/>
                <ig:PropertyNamePersistenceInfo PropertyName="SortingSettings"/>
            </ig:PersistenceSettings.PropertySettings>
        </ig:PersistenceSettings>
    </ig:PersistenceManager.Settings>
    <InfraGrid:XamGrid.FilteringSettings>
        <InfraGrid:FilteringSettings AllowFiltering="FilterRowTop" IsEnterKeyEditingEnabled="True" IsMouseActionEditingEnabled="SingleClick">
            <ig:PersistenceManager.Settings>
               <ig:PersistenceSettings SavePersistenceOptions="OnlySpecified">
                    <ig:PersistenceSettings.PropertySettings>
                        <ig:PropertyNamePersistenceInfo PropertyName="RowFiltersCollection"/>
                   </ig:PersistenceSettings.PropertySettings>
                </ig:PersistenceSettings>
            </ig:PersistenceManager.Settings>
        </InfraGrid:FilteringSettings>
    </InfraGrid:XamGrid.FilteringSettings>

 

When the grid reloads I do this.  Curiously enough the persistence manager seems to be preserving the sort sequence, which is arguably simpler, but not the filters. 

 

    private void OnLoaded(object sender, RoutedEventArgs args) {
      _viewModel = DataContext as QETGridViewModel;
      XamGrid grid = sender as XamGrid;
      if ((_viewModel != null) && (grid != null)) {
        if (_viewModel.GridSettings != null) {
          PersistenceSettings settings = PersistenceManager.GetSettings(grid);
          MemoryStream stream = new MemoryStream(_viewModel.GridSettings);
          PersistenceManager.Load(grid, stream, settings);
        }
      }
    }

 

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello Nick,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

Children
No Data