Skip to content

Commit

Permalink
fix odataparams
Browse files Browse the repository at this point in the history
  • Loading branch information
marosvolgyiz committed Feb 7, 2025
1 parent 55a284c commit 4d89609
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion apps/sensenet/src/components/tree/StyledTreeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const StyledTreeItem = withStyles((theme: Theme) =>
return repo
.loadCollection<GenericContent>({
path: props.contentValue.Path,
oDataOptions: { select: ['Path', 'Name', 'DisplayName', 'Type', 'Actions'] },
oDataOptions: {
select: ['Id', 'Path', 'Name', 'DisplayName', 'Type', 'Actions', 'Icon'],
onlyselectList: true,
},
})
.then((result) => {
sessionStorage.setItem(cacheKey, JSON.stringify(result))
Expand Down
1 change: 1 addition & 0 deletions packages/sn-client-core/src/Models/ODataParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type ODataInlineCountType = 'none' | 'allpages'
* Model class to define specific OData Request parameters. See https://docs.sensenet.com/api-docs/basic-concepts
*/
export interface ODataParams<T> {
onlyselectList?: boolean
/**
* The field(s) to be include in a $select list. Can be a field (e.g. 'DisplayName'), an array of fields (e.g. ['Name', 'Type']) or 'all'
*/
Expand Down
11 changes: 7 additions & 4 deletions packages/sn-client-core/src/Repository/ODataUrlBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ export class ODataUrlBuilder {
if (config.requiredSelect === 'all' || config.defaultSelect === 'all' || oDataParams?.select === 'all') {
oDataParams.select = undefined
} else {
oDataParams.select = this.combineODataFieldParameters<T>(
config.requiredSelect as any,
oDataParams.select ?? (config.defaultSelect as any),
)
if (oDataParams.onlyselectList === undefined || !oDataParams.onlyselectList) {
oDataParams.select = this.combineODataFieldParameters<T>(
config.requiredSelect as any,
oDataParams.select ?? (config.defaultSelect as any),
)
}
}
console.log(oDataParams.select)
oDataParams.metadata = oDataParams.metadata ?? config.defaultMetadata
oDataParams.inlinecount = oDataParams.inlinecount ?? config.defaultInlineCount
oDataParams.expand = oDataParams.expand ?? (config.defaultExpand as any)
Expand Down

0 comments on commit 4d89609

Please sign in to comment.