Grid column/sort/size preference persistence¶
This operation applies, saves, and clears a user's persisted grid layout preferences (column order/width, sort order, size) for both UltraWebGrid and WebDataGrid controls, backed by SAIF.Framework.Preferences.
| Field | Value |
|---|---|
| Operation ID | OP-AVPB-002 |
| Trigger | Called explicitly by consuming page code around grid data-bind/postback |
| Inputs | Grid instance, optional size div |
| Outputs | Grid layout applied/persisted, or an ORDER BY-style string |
| Primary components | AppViewPageBase.ApplyColumnPreferences, ApplySortPreferences, GetSortPreferenceOrderBy, SavePreferences, ClearPreferences (each overloaded for UltraWebGrid and WebDataGrid) |
| Entry point | SAIF.Presentation.Web.Core.Infragistics103\AppViewPageBase.aspx.vb |
Steps¶
ApplyColumnPreferences: for each grid band, first callsSaveDefaultLayout(captures the grid's as-designed column order/width/size intoViewData, to allow later reset).- Then reads
COLUMN_NAMES/COLUMN_WIDTHS/GRID_SIZEvalues fromm_controller.Model.Preferences(keyed by grid ID + band key) and applies them viaApplyColSettings(column reordering viaMove, width viaUnit, and div size for the first band only). ApplySortPreferences: reads a;-delimited,,-separated (column, direction) preference string, splits it, and appliesSortIndicator/SortedColumnsper column.- On failure: each column application is wrapped in a
Try/Catchthat silently ignores a missing/renamed column key. SavePreferences: clears all page-level preferences (Preferences.Clear(PrefScope.PageLevel)), then re-derives column name/width/sort strings from the grid's current live state and re-adds them.- If
Height/Widthare both greater than 0: also persists aGRID_SIZEentry. - Calls
Preferences.Save()once at the end. ClearPreferences: removes all four preference keys for the grid, saves twice (redundant), then callsApplyDefaultLayoutto restore the pre-preference layout captured by the lastSaveDefaultLayoutcall.- The
WebDataGridoverloads follow the same structural steps againstInfragistics.Web.UI.GridControls.WebDataGrid/Behaviors.Sorting/Behaviors.EditingCoreAPIs instead ofUltraWebGrid.DisplayLayout.Bands.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Grid data-bind/postback]) --> S1[SaveDefaultLayout captures as-designed layout]
S1 --> S2[ApplyColumnPreferences reads and applies COLUMN_NAMES/WIDTHS]
S2 --> S3[ApplySortPreferences reads and applies sort string]
S3 --> D1{Column key missing/renamed?}
D1 -->|Yes| Skip[Silently skip that column]
D1 -->|No| Applied[Sort applied]
Applied --> S4[User interacts, SavePreferences on postback]
S4 --> S5[Clear + re-derive + Save preferences]
S5 --> EndOk([Preferences persisted])
Failure and edge-case behavior¶
ApplySortPreferencessilently ignores a missing/renamed column key viaTry/Catch.ClearPreferencescallsPreferences.Save()twice, which is redundant but not harmful.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.Core.Infragistics103\AppViewPageBase.aspx.vb