+SliceSelectorOption = Marionette.ItemView.extend({
+ template: "#xos-sliceselector-option",
+ tagName: "option",
+ attributes: function() {
+ if (this.options.selectedID == this.model.get("id")) {
+ return { value: this.model.get("id"), selected: 1 };
+ } else {
+ return { value: this.model.get("id") };
+ }
+ },
+});
+
+SliceSelectorView = FilteredCompositeView.extend({
+ template: "#xos-sliceselector-select",
+ childViewContainer: "select",
+ childView: SliceSelectorOption,
+ caption: "Slice",
+
+ events: {"change select": "onSliceChanged"},
+
+ childViewOptions: function() {
+ return { selectedID: this.options.selectedID || this.selectedID || null };
+ },
+
+ onSliceChanged: function() {
+ this.sliceChanged(this.$el.find("select").val());
+ },
+
+ sliceChanged: function(id) {
+ console.log("sliceChanged " + id);
+ },
+
+ templateHelpers: function() { return {caption: this.options.caption || this.caption }; },
+});
+