Skip to content

Save / clear grid preferences

This operation captures the current grid layout (column order, widths, sort, and size) into the user's preference store, or removes all previously stored preference entries for a grid.

Field Value
Operation ID OP-CORE-005
Trigger User action on a consuming page (save layout / reset layout)
Inputs Grid instance, IncludeSort flag, optional height/width, SizeOnly flag
Outputs Persisted or removed preference entries
Primary components AppViewPageBase.SavePreferences, AppViewPageBase.ClearPreferences, AppViewPageBase.SaveDefaultLayout, AppViewPageBase.GetSortPrefs
Entry point SAIF.Presentation.Web.Core.Infragistics111/AppViewPageBase.aspx.vb

Steps

  1. Unless SizeOnly is set, iterate every band of the grid and build comma-delimited column-key and column-width lists. (BR-CORE-014)
  2. Add the ColNames… and ColWidths… entries to the preference store for each band.
  3. Evaluate the IncludeSort flag.
  4. If True: build the sort preference string via GetSortPrefs from the band's SortedColumns.
    • If the built string is non-empty: add ColSort… to the preference store. (BR-CORE-015)
    • If empty: skip adding the sort entry.
  5. If False: skip sort preference handling entirely.
  6. Evaluate Height and Width.
  7. If both are greater than zero: add GridSize<gridID> as "<height>px,<width>px". (BR-CORE-016)
  8. Otherwise: skip persisting a grid size.
  9. Call Preferences.Save() to persist all pending changes.
  10. Origin: Persistence is delegated to m_controller.Model.Preferences (SAIF.Framework.Preferences, package SAIF.BOF.Framework); the callee's storage mechanism is not visible from this repository.**

  11. ClearPreferences removes the ColNames…, ColWidths…, ColSort… and GridSize… entries and calls Preferences.Save().
  12. Note: Save() is invoked twice in succession in both the UltraWebGrid and WebDataGrid overloads (AppViewPageBase.aspx.vb lines 426–427 and 707–708) — a redundant call with no functional effect beyond the extra round trip.*

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([User saves or clears layout]) --> Which{Save or Clear?}
    Which -->|Save| S1{SizeOnly?}
    S1 -->|No| S2[Build ColNames/ColWidths per band]
    S1 -->|Yes| S3[Skip column capture]
    S2 --> S4{IncludeSort?}
    S3 --> S4
    S4 -->|Yes, non-empty sort| S5[Add ColSort entry]
    S4 -->|No / empty| S6[Skip sort entry]
    S5 --> S7{Height and Width > 0?}
    S6 --> S7
    S7 -->|Yes| S8[Add GridSize entry]
    S7 -->|No| S9[Skip grid size]
    S8 --> S10[Preferences.Save]
    S9 --> S10
    Which -->|Clear| C1[Remove ColNames/ColWidths/ColSort/GridSize entries]
    C1 --> C2[Preferences.Save called twice]

Failure and edge-case behavior

  • ClearPreferences calling Preferences.Save() twice is a known redundancy, not a functional defect — the second call persists no additional changes.*
  • No validation occurs on the supplied Height/Width beyond the zero-or-greater check.

Sources

  • SAIF.Presentation.Web.Core.Infragistics111/AppViewPageBase.aspx.vb