Member Of |
|
Base Control |
|
Description |
Creates a customizable star rating control. |
Usage |
Apply to an entity property having a numeric data type. |
Generated Code
myapp.ScreenName.PropertyName_render = function (element, contentItem) {
var div = $("<div/>");
div.appendTo($(element));
div.wijrating({
rated: function (e, data) {
var newValue = data.value;
if (contentItem.value != newValue) {
contentItem.value = newValue;
}
},
reset: function (e) {
contentItem.value = c1ls.isNullableType(contentItem) ? null : 0;
}
});
contentItem.dataBind("value", function (newValue) {
div.wijrating({
value: newValue
});
});
};
Remarks
If you need to set additional options on the widget, add them to the initializer passed to the constructor.
The rated event is handled to update the bound value whenever the end user changes the current value by clicking one of the rating icons.
The reset event is handled to update the bound value whenever the end user clicks the reset button. The new value is either null or zero depending upon the semantics of the bound contentItem.
The dataBind method call ensures that the widget stays in sync whenever the bound value changes.