Skip to content

Instantly share code, notes, and snippets.

getUserById: function (id) {
var self = this;
return new Promise( function( resolve, reject ){
if ( id ){
var context = new SP.ClientContext.get_current();
var userInfoList = context.get_web().get_siteUserInfoList();
var query = new SP.CamlQuery();
var refiner = $getClientControl(document.getElementById($('div[refinername="' + refinerName + '"]').attr('id')));
/*
Where "refinerName" is the refiner - you now have the SP Refiner control from which you can invoke any refiner methods
Apply a refinement
refiner.addRefinementFilter(refinerName,'\"Refinement Value\"');
Apply a refinement with Or
refiner.addRefinementFiltersJSONWithOr('{\u0022' + refinerName + '\u0022:Refinement Value}');
for (var i in listData) {
...
//underneath these lines in the Display Template
if (ctx.RefinementControl.propertyName == "MediaDuration") {
Srch.U.modifyMediaDurationRefinementName(listData[i]);
}
/*
an alternative to the approach below would be to store the array indexes of the refinements you want to remove in a
seperate array and then reverse this array before doing the deletions.
/*
Commenting out the FileType overrides for the sort.
if (ctx.RefinementControl.propertyName == "FileType") {
unselectedFilters = unselectedFilters.sort(SortAlphabetically);
}
*/
this.Options = { ShowClientPeoplePicker: false, ShowCounts: true };
<property name="SelectedRefinementControlsJson" type="string">
{"refinerConfigurations":[
{
"propertyName":"SPContentType",
...
"maxNumberRefinementOptions":15,
...
"displayName":"Result Type"
...
}
( function ( workspace, $ ) {
var matches = [];
//this is where we keep track of our refinement items for the Workspace refiner
var workspaceItems;
workspace.Mapping = {
//straight site collection one to one mapping on SPSiteURL. This is detailed in the first part of the scenario.
Simple: {
( function ( workspace, $ ) {
...
workspace.Mapping = {
...
};
/*
Now we need to include the private internal and public methods for our custom refiner
( function ( workspace, $ ) {
...
workspace.Mapping = {
...
/*
Meanwhile - underneath the community mapping
( function ( workspace, $ ) {
//we keep track of previous refinement item matches in this array
var matches = [];
//this is where we keep track of our refinement items for the Workspace refiner
var workspaceItems;
workspace.Mapping = {
//straight site collection one to one mapping on SPSiteURL. This is detailed in the first part of the scenario.
Simple: {