Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…s-react into dev
  • Loading branch information
jrodriguesStorm committed Mar 4, 2024
2 parents dcf33e3 + f62c218 commit f11250c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/controls/dynamicForm/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,11 @@ export class DynamicForm extends React.Component<
try {

// Fetch form rendering information from SharePoint
const listInfo = await this._spService.getListFormRenderInfo(listId);
const listInfo = await this._spService.getListFormRenderInfo(listId, this.webURL);

// Fetch additional information about fields from SharePoint
// (Number fields for min and max values, and fields with validation)
const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId);
const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId, this.webURL);
const numberFields = additionalInfo.filter((f) => f.TypeAsString === "Number" || f.TypeAsString === "Currency");

// Build a dictionary of validation formulas and messages
Expand Down Expand Up @@ -1178,7 +1178,8 @@ export class DynamicForm extends React.Component<
const response = await this._spService.getSingleManagedMetadataLabel(
listId,
listItemId,
field.InternalName
field.InternalName,
this.webURL
);
if (response) {
selectedTags.push({
Expand Down Expand Up @@ -1243,7 +1244,7 @@ export class DynamicForm extends React.Component<
}

dateFormat = field.DateFormat || "DateOnly";
defaultDayOfWeek = (await this._spService.getRegionalWebSettings()).FirstDayOfWeek;
defaultDayOfWeek = (await this._spService.getRegionalWebSettings(this.webURL)).FirstDayOfWeek;
}

// Setup Thumbnail, Location and Boolean fields
Expand Down Expand Up @@ -1333,7 +1334,8 @@ export class DynamicForm extends React.Component<
listItemId,
file.fileName,
buffer,
undefined
undefined,
this.webURL
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/services/SPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@ export default class SPService implements ISPService {
}
}

public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string, webUrl?: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
try {
const webAbsoluteUrl = this._context.pageContext.web.absoluteUrl;
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/RenderListDataAsStream?@listId=guid'${encodeURIComponent(listId)}'`;
const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, {
body: JSON.stringify({
Expand Down

0 comments on commit f11250c

Please sign in to comment.