1

The Listview(partial page) is not getting refreshed when I click the button. It keeps on adding the rows whenever the buttons are clicked.

Below are the functions for adding the drivers.

function getDriversFromPolicy_CA7()  : CA7CommAutoDriver[] {
    var drivers = this.Policy.LatestPeriod.CA7Line.Drivers // **this** Contingency Entity
    var excludeDrivers = this.ExcludeDrivers_CA7.toList() // Contingency entity has a ExcludeDrivers_CA7 array
    if(excludeDrivers.Empty) {
      drivers?.each(\driver -> this.addToExcludeDrivers_CA7(driver) )
    } else {
      drivers.each(\driver -> {
        if (excludeDrivers.where(\elt -> elt.LicenseNumber == driver.LicenseNumber).toList().Count == 0) {
          this.addToExcludeDrivers_CA7(driver)
        }
      })
    }

    return this.ExcludeDrivers_CA7
  }

  function getDriversFromTransaction_CA7() : CA7CommAutoDriver[] {
    var drivers = this.PolicyPeriod.CA7Line.Drivers.toList()
    var excludeDrivers = this.ExcludeDrivers_CA7.toList()
    if(this.ExcludeDrivers_CA7.IsEmpty) {
      drivers?.each(\driver -> this.addToExcludeDrivers_CA7(driver) )
    } else {
//      this.ExcludeDrivers_CA7.toList().retainAll(drivers.toList())
      drivers.each(\driver -> {
        if (excludeDrivers.where(\elt -> elt.LicenseNumber == driver.LicenseNumber).toList().Count == 0) {
          this.addToExcludeDrivers_CA7(driver)
        }
      })
    }
    return this.ExcludeDrivers_CA7
  }

  function removeDrivers_CA7(driver : CA7CommAutoDriver) {
    this.removeFromExcludeDrivers_CA7(driver)
  }

pcf screenshot for reference

UI screenshot for reference

Madhu
  • 11
  • 3
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 08 '22 at 12:03
  • Your question is still not clear enough. What refresh are your trying to do? Where is the button to refresh and what is the code behind it? Please follow this https://stackoverflow.com/help/how-to-ask – Arjun Jun 10 '22 at 06:35
  • @Arjun I have attached the pcf file and the UI screenshot for reference, the above code is the one executes after the click event. I want my target list view/ table to be recreated(new set of rows to be added instead of appending to the previous rows). – Madhu Jun 10 '22 at 16:01
  • At a high level, this looks like a code issue and not a refresh issue with the LV. Your code only seems to add to the list which is why the LV keeps appending to the view. With this design, I would suggest you to update the code on the toAdd section or the code behind the add button on the LV to remove existing values and then add the new values. – Arjun Jun 13 '22 at 06:16

0 Answers0