Skip to content

Instantly share code, notes, and snippets.

@estruyf
Created January 26, 2015 15:11
Show Gist options
  • Select an option

  • Save estruyf/b7108e73d498e5154584 to your computer and use it in GitHub Desktop.

Select an option

Save estruyf/b7108e73d498e5154584 to your computer and use it in GitHub Desktop.
Trick the refiner into thinking it is a date and time MP
var propertyName = ctx.RefinementControl.propertyName;
// Let the refiner think it is a datetime field, needed for custom managed properties
ctx.RefinementControl.propertyName = trickDateProperty(propertyName);
// Retrieving the labels
ctx.BucketedFilterData = AjaxControlToolkit.SliderRefinementControl.GetDefaultBuckets(ctx);
// Reset the property name
ctx.RefinementControl.propertyName = propertyName;
function trickDateProperty (prop) {
// Check if the property does not contain the OWSDATE suffix
if (prop.toUpperCase().indexOf('OWSDATE') === -1) {
return prop + "OWSDATE";
}
return prop;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment