ui icon indicating copy to clipboard operation
ui copied to clipboard

Is it possible to change the value without triggering the output event.

Open arthurc2000 opened this issue 3 years ago • 1 comments
trafficstars

I attempted to recover the UI display without to trigger the output event. Is it possible to do that without working around it ?

Thanks Arthur

e.g. for Number

https://nexus-js.github.io/ui/api/#Number

value number The interface's current value. If set manually, will update the interface and trigger the output event.

arthurc2000 avatar Feb 08 '22 15:02 arthurc2000

For most Nexus components the change event handler allows you to check this.clicked to determine whether the value change happened from a direct user interaction or not. You can use that to have different code run in either scenario. For example

number.on('change', function(value) {
  if (this.clicked) {
    // do stuff to handle a value change actually made by user
  } else {
    // do nothing, or do stuff that should only happen when the value is changed internally/manually
  }
})

marcelblum avatar Feb 08 '22 17:02 marcelblum