These are chat archives for chandu0101/scalajs-react-components

Jun 2016
Raul Rodriguez
Jun 16 2016 01:58
Hi guys, any advice how to debug MuiTable, I’m using an AjaxClient to get the elements I want to fill this table, but so far the Table is rendering with zero elements only the header and footer.
val component = ReactComponentB[Unit](“PolicyList")
        fixedHeader = false,
        fixedFooter = false,
        stripedRows = true,
        showRowHover = true,
        selectable = true,
        multiSelectable = false,
        enableSelectAll = false,
        deselectOnClickaway = true,
        height = "400px",
        selected = js.Array[Int]()
case class Backend(s: BackendScope[Unit, State]) {
  var policies :List[Policy] = List()

  def getPolicies = Callback {
      import autowire._
      import upickle.default._
      import scalajs.concurrent.JSExecutionContext.Implicits.queue
      AjaxClient[PolicyApi].getPolicies().call().foreach (
        seqPolizas => policies = seqPolicies.toList
Something tells me that the assignment of policies is not working or not getting executed.
Chandra Sekhar Kode
Jun 16 2016 02:05
hmm once you get the data you need to update state to tell react to rerender
put policies in state
seqPolizas => policies = seqPolicies.toList change to seqPolizas => s.modState(s => s.copy(policies = seqPolicies.toList)).runNow()
Raul Rodriguez
Jun 16 2016 03:00
@chandu0101 thanks a lot, I knew I was forgetting something there :)