Skip to content

Picklist all #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ declare module fng {
readRecord: (modelName: string, id: string, formName?: string) => angular.IHttpPromise<any>;
getAll: (modelName: string, _options: any) => angular.IHttpPromise<any[]>;
getAllListAttributes: (ref: string) => angular.IHttpPromise<ILookupItem[]>;
getAllPickListAttributes: (ref: string) => angular.IHttpPromise<ILookupItem[]>;
getPagedAndFilteredList: (
modelName: string,
options: IListQueryOptions
Expand Down
5 changes: 5 additions & 0 deletions src/client/js/services/submissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ module fng.services {
},

// return only the list attributes for ALL records in the given collection, returning ILookupItem[]
// getAllPickListAttributes() is intended to be used to retrieve records for display in a picklist;
// getAllListAttributes() for all other use cases
getAllListAttributes: function (ref: string): angular.IHttpPromise<ILookupItem[]> {
return $http.get(`/api/${ref}/listAll`, { cache: expCache });
},
getAllPickListAttributes: function (ref: string): angular.IHttpPromise<ILookupItem[]> {
return $http.get(`/api/${ref}/picklistAll`, { cache: expCache });
},

// return only the list attributes for records in the given collection that satisfy the given query conditions (filter, limit etc.)
// return ILookupItem[] if options.concatenate is true, else the raw documents
Expand Down
11 changes: 10 additions & 1 deletion src/server/data_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ export class FormsAngular {
processArgs(this.options, [resourceName, this.collectionGet()])
);

// return the List attributes for all records - used by record-handler's setUpLookupOptions() method, for cases
// return the List attributes for all records. two endpoints that go through the same handler so permissions
// can be applied differently for the two use cases. /listAll is intended for listing records on a page;
// /picklistAll for listing them in a <select> or similar - used by record-handler's setUpLookupOptions() method, for cases
// where there's a lookup that doesn't use the fngajax option
this.app.get.apply(
this.app,
Expand All @@ -159,6 +161,13 @@ export class FormsAngular {
this.entityListAll(),
])
);
this.app.get.apply(
this.app,
processArgs(this.options, [
resourceName + "/picklistAll",
this.entityListAll(),
])
);

// return the List attributes for a record - used by fng-ui-select
this.app.get.apply(
Expand Down
Loading