Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Here is a code snippet revealing the most common features:

// initialize new matrix with three columns
def matrix = api.newMatrix("Item", "Quantity", "Price")

// add more columns dynamically
matrix.addColumn("Margin %")
matrix.addColumn("Url")

// set column formats
matrix.setColumnFormat("Item", FieldFormatType.TEXT)
matrix.setColumnFormat("Quantity", FieldFormatType.NUMERIC_LONG)
matrix.setColumnFormat("Price", FieldFormatType.MONEY_EUR)
matrix.setColumnFormat("Margin %", FieldFormatType.PERCENT)
matrix.setColumnFormat("Url", FieldFormatType.LINK)

// allow users to filter values
matrix.setEnableClientFilter(true)

// add data row
matrix.addRow([
        "Item": matrix.styledCell("Red bold text", "#ff0000", "transparent", "bold"),
        "Quantity": 1.23456,
        "Price": 78.9012,
        "Margin %": 0.3456,
        "Url": "http://www.google.com"
])

// optionally you can add link to a pricegrid
matrix.linkToPriceGrid("Open Pricegrid", 123, null)
// or to a pricelist
matrix.linkToPriceList("Open Pricelist", 123, null)
// or a to custom page (result identical to the previous)
matrix.linkCell("Open Pricelist", "priceListPage", [
        "id" : "123.PL",
        "criteria" : null
])
// or add a library images, such as Traffic, BlackTraffic or Arrow
matrix.libraryImage("BlackTraffic", "green")
// or add a general image
matrix.imageCell("https://www.pricefx.eu/images/grid/approve.png")


return matrix

(tick) If you have performance issues with large tables, avoid saving preferences with the 'Auto fit all columns' option enabled, as mentioned in the Knowledge Base.

  • No labels