[Suggestion] DataRepeater & RepeaterChildSupport need checkbox behavior

Hi !
I know 2.3 will be released, but i would suggest (maybe for next minor update) to add an option for RepeaterChildSupport to disable deselect on single selected object.
Indeed, the current behavior is to deselect item if you tap on it, but it is useful for list menus to disable this behavior on single selection, so we always have a selected entry (checkbox behavior).

I suggest to simply add an option to repeater, like allowNone: true by default, which is checked by ChildSupport when current is selected. If allowNone is false, do nothing.

Thanks for any answer.

Comments

  • In fact, it's about _selectionHandler, which could be enhanced with checkbox behavior.
  • The selection method is designed to accomodate the five-way navigation needed for TV interfaces. Is this something you could handle by actually having checkbox items all in the same group in the DataRepeater?
  • I didn't dig into Checkboxes yet. But for my menus, i needed Scrollable Lists, feeded by data Array or Collection.
    So DataRepeater are perfectly fitted to my needs, but as menus, i don't want the user to unselect the current navigation item.

    Thus, i added this little override, to disable deselection:
    enyo.RepeaterChildSupport._selectionHandler = function () {
        if (this.repeater.selection && !this.get("disabled")) {
            if (this.repeater.multipleSelection || !this.repeater.isSelected(this.model) || this.repeater.allowNone == undefined || this.repeater.allowNone == true)
            {
                this.set("selected", !this.selected);
            }
        }
    };

    It doesn't change default behavior, but if allowNone is false, once something is selected, you can't unclick it.
    Maybe it's a very specific case, but i already found this kind of behavior in List plugins i used.
  • I've needed the same thing
  • The best way to make sure this stays on our radar is to make an issue at jira.enyojs.com. I've warmed to the idea now that you've explained it more.
Sign In or Register to comment.