SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val gridCatalog = new GridCatalogs()
  2.  
  3. val onChoiceItem = SinkObserver.create[ ( String, String ) ]{ case ( id, description ) =>
  4.     grid.hdlRowActive.foreach { idx =>
  5.       store.store.onNext (
  6.         store.UpdateIdx(idx, Tenderer (id_comparative = "100-2019-ADQ2",key_provider = id, business_name = Some(description)))
  7.         )
  8.     }
  9.     hdlCatalog.onNext(Seq.empty)
  10.     Continue
  11.   }
  12.  
  13.  val gridCatalogSearchResult = grid.hdlPositionCursor.combineLatest ( hdlCatalog ).map { case ( pos, catalog ) =>
  14.     val cata = catalog.map ( i => i._1 -> i._2 ).toMap
  15.     if (!catalog.isEmpty)
  16.       Some(gridCatalog.render(cata, pos, cata.isEmpty, onChoiceItem))
  17.     else
  18.       None
  19.   }
  20.  
  21.   def mainGrid ( items: Map [ Int, Map [ String,String ] ] ) =
  22.     div ( clear.both, marginTop := "40px",
  23.         grid.render ( items ),
  24.         gridCatalogSearchResult
  25.     )
  26.  
  27.   def render =  store.store.switchMap { case (a, s) =>        // concatMap or switchMap { s =>       // for { s <- store.store } yield {
  28.     val dataGrid = s.tenderers.items.zipWithIndex.map { case ( prov, i ) =>
  29.         i -> Seq ( "rfc" -> prov.key_provider, "proveedor" -> prov.business_name.getOrElse ( "" ) ).toMap
  30.     }.toMap
  31.     Observable ( mainGrid(dataGrid) )
  32.     )
  33.   }
  34.  
  35. ///*****
  36. class GridCatalogs {
  37.   def render ( values: Map[String, String], pos: (Int, Int), hid: Boolean, onClickItem: SinkObserver[(String, String)]) =
  38.       table ( key := "gridCatalog", cls := "gridCatalog", width := "500px", height := "20px", position.absolute, zIndex := 1000002,
  39.                 top := pos._1.toString + "px", left := pos._2.toString + "px", //hidden := (if(hid) true else false),
  40.         thead( tr( td( "Id", textAlign := "Center" ), td ( "DescripciĆ³n", textAlign := "Center" ) ) ),
  41.         tbody (
  42.           values.map { case ( k, v ) =>
  43.                 tr ( onClick.use( ( k, v ) ) --> onClickItem,
  44.                   td(k, textAlign := "Justify", width :="30px"),
  45.                   td(v, textAlign := "Justify", width :="100px")
  46.                 )}.toList
  47.         )
  48.       )
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top