medusa-ui/medusa

Rewrite: change

Closed this issue · 2 comments

We will need a custom tag for a change event. In JS, 'change' means an event function when the value of an <input>, <select>, or <textarea> element has been changed. The event also applies to elements withcontenteditableenabled.

In Medusa 0.x this worked like m:click="increaseCounter(1, 'ABC')

The goal is to be able to reference a method on the controller side directly.

  • Should be able to refer to a method without parameter doAction()
  • Should be able to add parameters to the method doAction(1, 'ABC')
  • Should be able to refer to other values (ie if I click, send the value of an input field as parameter); I have no requirement on how to refer to this, my suggestion would be doAction(#mySearchField, 123)
  • Should be able to refer to your own value doAction(this.value, 123), again - not sure what the best way to write this would be

ref: PR #274

Partially solved with PR. Added sorting fix for 'selected' behaviour; works better if a 'selected' attribute set ends up being the last executed edit. Browsers would otherwise visually set the select to blank.

Still need to review how many of the above usecases are solved by this.