Skip to content

Commit

Permalink
Merge pull request #1887 from wilecoyotegenius/fix-1870
Browse files Browse the repository at this point in the history
#1870 fix
  • Loading branch information
joaojmendes authored Oct 18, 2024
2 parents a443fcd + 4125609 commit ee147ae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/SPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,12 @@ export default class SPService implements ISPService {
orderByStr = `<OrderBy><FieldRef Name="${orderByParts[0]}" ${ascStr} />`;
}

const camlQuery = `<View><Query><Where>${substringSearch ? '<Contains>' : '<BeginsWith>'}<FieldRef Name="${internalColumnName}"/><Value Type="${field.ResultType}">${filterText}</Value>${substringSearch ? '</Contains>' : '</BeginsWith>'}</Where>${orderByStr}</Query></View>`;
let filterPart = ""
if (filterText) {
filterPart = `<Where>${substringSearch ? '<Contains>' : '<BeginsWith>'}<FieldRef Name="${internalColumnName}"/><Value Type="${field.ResultType}">${filterText}</Value>${substringSearch ? '</Contains>' : '</BeginsWith>'}</Where>`
}

const camlQuery = `<View><Query>${filterPart}${orderByStr}</Query></View>`;

apiUrl = `${webAbsoluteUrl}/_api/web/lists('${listId}')/GetItems(query=@v1)?$select=${keyInternalColumnName || 'Id'},${internalColumnName}&@v1=${JSON.stringify({ ViewXml: camlQuery })}`;
isPost = true;
Expand Down

0 comments on commit ee147ae

Please sign in to comment.