Last active
October 6, 2019 00:31
-
-
Save elyphas/f55e6d6b3f02e17f775cec76af14d380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cmpInput444(lbl: String, hdl: Handler[String], props: VDomModifier, events: VDomModifier) = | |
div( id := "txt" + lbl, | |
float.left, props, | |
label( lbl, props ), | |
input ( key := "txt" + lbl, | |
value <-- hdl.map ( t => if(t == "0") "" else t ), | |
onKeyUp.map { k => | |
val txt = k.currentTarget.asInstanceOf[html.Input] | |
if(txt.value == "") "0" else txt.value | |
} --> hdl, | |
//onChange.target.value --> hdl, | |
props, events | |
) | |
) | |
val getIdComparative: Observable[String] = (txtEjercicio: Observable[Int], txtFolio: Observable[Int]) | |
.parMapN{ case (ejercicio: Int, folio: Int) => | |
folio + "-" + ejercicio + "-" + "ADQ2" | |
} | |
val ver = SinkObserver.create[String]{ id => store.store.onNext(store.UpdateIdComparative(id)) | |
} | |
val onChangeDebounce = onKeyUp.debounce( 500 milliseconds).transform ( | |
_.lift[Observable].withLatestFrom(getIdComparative) | |
{ case (event, id) => id } ) --> ver // --> store.store | |
cmpInput444("Folio", txtFolio.mapHandler[String]( _.toInt )(_.toString), VDomModifier(width:="75px"), VDomModifier(onChangeDebounce)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment