Skip to content

Instantly share code, notes, and snippets.

@elyphas
Created October 4, 2019 19:28
Show Gist options
  • Save elyphas/37386a65a9185e719bfda359228d8091 to your computer and use it in GitHub Desktop.
Save elyphas/37386a65a9185e719bfda359228d8091 to your computer and use it in GitHub Desktop.
class FrmInvitationToTender {
val gridCatalog = new GridCatalogs()
val onChoiceItem = SinkObserver.create[ ( String, String ) ]{ case ( id, description ) =>
grid.hdlRowActive.foreach { idx =>
store.store.onNext (
store.UpdateIdx(idx, Tenderer (id_comparative = "100-2019-ADQ2",key_provider = id, business_name = Some(description)))
)
}
hdlCatalog.onNext(Seq.empty)
Continue
}
val gridCatalogSearchResult = grid.hdlPositionCursor.combineLatest ( hdlCatalog ).map { case ( pos, catalog ) =>
val cata = catalog.map ( i => i._1 -> i._2 ).toMap
if (!catalog.isEmpty)
Some(gridCatalog.render(cata, pos, cata.isEmpty, onChoiceItem))
else
None
}
def mainGrid ( items: Map [ Int, Map [ String,String ] ] ) =
div ( clear.both, marginTop := "40px",
grid.render ( items ),
gridCatalogSearchResult
)
def render = store.store.switchMap { case (a, s) => // concatMap or switchMap { s => // for { s <- store.store } yield {
val dataGrid = s.tenderers.items.zipWithIndex.map{case(prov,i)=>i->Seq("rfc"->prov.key_provider,"proveedor"->prov.business_name.getOrElse("")).toMap }.toMap
Observable ( mainGrid(dataGrid) )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment