Skip to content

Be able to reference HTML element's reactive properties during cell creation #72

@rmehlinger

Description

@rmehlinger

Currently, a bound attribute on an HTML element cannot reference the reactive properties of the element itself. If, for instance, I want a checkbox to always be enabled if it's already checked, it seems that I have to take the following, slightly complicated approach:

  isChecked = rx.cell()
  R.input {
    type: 'checkbox'
    change: -> isChecked.set($(@).is(':checked'))
    disabled: bind -> not isChecked.get() and someOtherCell.get()
  }

It would be nice to be able to do something like:

  R.input {
    type: 'checkbox'
    disabled: eBind ($elem) -> not $elem.rx('checked').get() and someOtherCell.get()
  }

It would be even nicer if, instead of adding an argument to bind, we could do something like:

  R.input {
    type: 'checkbox'
    disabled: bind => not @.rx('checked').get() and someOtherCell.get()
  }

However, I'm not sure this last is feasible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions