We are trying to add a slider jquery widget, and would like to define a static range, say percentage from 0% to 100%. Then we would like to use the value from the slider in that range as the parameter for the TOP(x), as shown on the picture.
Is this possible? Any hints ?
I've created an example report for you, import it using the default [Sales] schema https://drive.google.com/file/d/0B3kSph_LgXizdk9OdnlTWkxHa1U/view?usp=sharing
You could achieve this functionality by using the next sequence:
viz.filters.Slider.prototype.componentWillMount = function(){
if(_.isArray(this.props.items))
this.setState({
entities:new viz.EntityData(this.props.items),
range:_.map(this.props.defaults,"uniqueName")
});
}
viz.filters.Slider.prototype.onBuildAllDone = function(){
if(!_.isEmpty(this.state.range)) {
this.fireEvent(vizEventType.onSelection,
this.createEvent(this.state.range));
this.fireEvent(vizEventType.onNewLabel,
this.createEvent(this.state.range));
}
}
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-init') {
// Following code will replace a data provider for Slider
// with generated numbers. But to do so, you'll need UID of
// the Slider widget, in this example it's "w1"
var widget = event.value.widgetMgr().getItemById("w1");
_.assign(widget.builder().guts_, {
items:_.times(100, function(idx){
return {
name:idx + 1 + "%",
uniqueName:idx + 1
}
})})
}
}