@@ -103,6 +103,12 @@ export interface GridMessage {
103103 type ?: string ;
104104}
105105
106+ export enum SavedSettings {
107+ all = 'all' , // Restores filters, maxRows, sorts, and view
108+ noFilters = 'noFilters' , // Restores maxRows and sorts only
109+ none = 'none' ,
110+ }
111+
106112export interface QueryConfig {
107113 /**
108114 * An array of base [Filter.IFilter](https://labkey.github.io/labkey-api-js/interfaces/Filter.IFilter.html)
@@ -209,12 +215,17 @@ export interface QueryConfig {
209215 urlPrefix ?: string ;
210216
211217 /**
212- * If true we will load filters, sorts, pageSize, and viewName from localStorage when initially loading the model,
213- * but only if there are no settings on the URL. Important: If you are using this flag you must ensure your grid id
214- * is stable and unique. It must be stable between page loads/visits, or we won't be able to fetch the settings. It
215- * must be unique, or we'll override settings for other grid models.
218+ * Used to optionally load saved settings from localStorage when initially loading the model, but only if there are
219+ * no settings on the URL.
220+ * - 'all' will load filters, sorts, pageSize, and viewName
221+ * - 'noFilters' will load sorts and pageSize
222+ * - 'none' disables this feature
223+ *
224+ * Important: If you are using this flag you must ensure your grid id is stable and unique. It must be stable
225+ * between page loads/visits, or we won't be able to fetch the settings. It must be unique, or we'll override other
226+ * grid models.
216227 */
217- useSavedSettings ?: boolean ;
228+ useSavedSettings ?: SavedSettings ;
218229}
219230
220231export const DEFAULT_OFFSET = 0 ;
@@ -345,12 +356,17 @@ export class QueryModel {
345356 */
346357 readonly urlPrefix ?: string ;
347358 /**
348- * If true we will load filters, sorts, pageSize, and viewName from localStorage when initially loading the model,
349- * but only if there are no settings on the URL. Defaults to false. Important: If you are using this flag you must
350- * ensure your grid id is stable and unique. It must be stable between page loads/visits, or we won't be able to
351- * fetch the settings. It must be unique, or we'll override settings for other grid models.
359+ * Used to optionally load saved settings from localStorage when initially loading the model, but only if there are
360+ * no settings on the URL.
361+ * - 'all' will load filters, sorts, pageSize, and viewName
362+ * - 'noFilters' will load sorts and pageSize
363+ * - 'none' disables this feature
364+ *
365+ * Important: If you are using this flag you must ensure your grid id is stable and unique. It must be stable
366+ * between page loads/visits, or we won't be able to fetch the settings. It must be unique, or we'll override other
367+ * grid models.
352368 */
353- useSavedSettings ?: boolean ;
369+ readonly useSavedSettings ?: SavedSettings ;
354370
355371 /**
356372 * An array of [Filter.IFilter](https://labkey.github.io/labkey-api-js/interfaces/Filter.IFilter.html)
@@ -505,7 +521,7 @@ export class QueryModel {
505521 this . totalCountError = undefined ;
506522 this . totalCountLoadingState = LoadingState . INITIALIZED ;
507523 this . urlPrefix = queryConfig . urlPrefix ?? 'query' ; // match Data Region defaults
508- this . useSavedSettings = queryConfig . useSavedSettings ?? false ;
524+ this . useSavedSettings = queryConfig . useSavedSettings ?? SavedSettings . none ;
509525 this . charts = undefined ;
510526 this . chartsError = undefined ;
511527 this . chartsLoadingState = LoadingState . INITIALIZED ;
0 commit comments