Skip to content

Commit

Permalink
Enhance FilterSearchBox to correctly parse user names from SharePoint…
Browse files Browse the repository at this point in the history
… results
  • Loading branch information
kasperbolarsen committed Feb 11, 2025
1 parent e17d9d9 commit 1d50bef
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 18 deletions.
16 changes: 14 additions & 2 deletions search-parts/src/components/filters/FilterSearchBoxComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,20 @@ export class FilterSearchBox extends React.Component<IFilterSearchBoxProps, IFil
let propsitemname:string = props.item.name;
if(props.item.name.indexOf("i:0#.f") > -1)
{
propsitemname = props.item.name.split('|')[1]
// propsitemname = "testing"
//From localSharePointResults: Admin@tcwlv.onmicrosoft.com | Kasper Larsen | 693A30232E667C6D656D626572736869707C61646D696E407463776C762E6F6E6D6963726F736F66742E636F6D i:0#.f|membership|[email protected]
//From localPeopleResults: i:0#.f|membership|[email protected]
if(props.item.name.indexOf("i:0#.f") === 0)
{
propsitemname = props.item.name.split('|')[2]
}
else
{
propsitemname = props.item.name.split('|')[1]

}



}


Expand Down
59 changes: 43 additions & 16 deletions search-parts/src/layouts/filters/vertical/vertical.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,51 @@
<div class="filter--values-list">
{{#each filter.values}}

<!-- From localSharePointResults: [email protected] | Kasper Larsen | 693A30232E667C6D656D626572736869707C61646D696E407463776C762E6F6E6D6963726F736F66742E636F6D i:0#.f|membership|[email protected] -->
<!-- From localPeopleResults: i:0#.f|membership|[email protected] -->

<!-- <div title="{{#with (split name '|')}}{{[1]}}({{[0]}}){{/with}} {{#if ../showCount}}({{count}}){{/if}}" class="filter--value"> -->

{{#eq (itemAt (split name "|") 1) "membership"}} <!-- this must be from localPeopleResults -->
<div title="{{#with (split name '|')}}{{[2]}}{{/with}} {{#if ../showCount}}({{count}}){{/if}}" class="filter--value">
<pnp-filtercheckbox
data-instance-id="{{@root.instanceId}}"
data-filter-name="{{filter.filterName}}"
data-name= "{{#with (split name '|')}}{{[2]}}{{/with}}"
data-value="{{value}}"
data-selected="{{selected}}"
data-disabled="{{disabled}}"
data-count="{{count}}"
data-is-multi="{{../isMulti}}"
data-theme-variant="{{JSONstringify @root.theme}}"
>
</pnp-filtercheckbox>
{{#if ../showCount}}
<span data-ui-test-id="filterCount">({{count}})</span>
{{/if}}
</div>
{{else}}
<div title="{{#with (split name '|')}}{{[1]}}{{/with}} {{#if ../showCount}}({{count}}){{/if}}" class="filter--value">
<pnp-filtercheckbox
data-instance-id="{{@root.instanceId}}"
data-filter-name="{{filter.filterName}}"
data-name= "{{#with (split name '|')}}{{[1]}}{{/with}}"
data-value="{{value}}"
data-selected="{{selected}}"
data-disabled="{{disabled}}"
data-count="{{count}}"
data-is-multi="{{../isMulti}}"
data-theme-variant="{{JSONstringify @root.theme}}"
>
</pnp-filtercheckbox>
{{#if ../showCount}}
<span data-ui-test-id="filterCount">({{count}})</span>
{{/if}}
</div>
<pnp-filtercheckbox
data-instance-id="{{@root.instanceId}}"
data-filter-name="{{filter.filterName}}"
data-name= "{{#with (split name '|')}}{{[1]}}{{/with}}"
data-value="{{value}}"
data-selected="{{selected}}"
data-disabled="{{disabled}}"
data-count="{{count}}"
data-is-multi="{{../isMulti}}"
data-theme-variant="{{JSONstringify @root.theme}}"
>
</pnp-filtercheckbox>
{{#if ../showCount}}
<span data-ui-test-id="filterCount">({{count}})</span>
{{/if}}
</div>
{{/eq}}



{{/each}}
</div>
{{else}}
Expand Down

0 comments on commit 1d50bef

Please sign in to comment.