Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Reference multiple rows in formula builder

    FormulaBuilder and features like hilite seem to be built around the idea that input values will always come from the row. What if one wants to utilize values fro different rows, is there a way to express that? For instance if the user wants to hilite if row[0].value < row[0+1].value. Anyone know a way to do this (that would execute efficiently)?


    #2
    If it's not a requirement that end users be able to build such formulas, you can do whatever you want with a CellFormatter - it's just Java.

    As far as end users being able to express such formulas, we did actually build the FormulaBuilder so that it's extensible - you can add your own functions that end users can use. That means you could add a new function like nextRecordValue(), for example.

    Because your custom MathFunction only receives what the end user passes to it, this would require a bit of a hack - you'll have to make the ListGrid and current record index available as global variables so your custom MathFunction can pick them up.

    The other bit of bad news is that this is one of the very rare APIs that are available in SmartClient but not wrapped for SmartGWT. Static typing makes wrapping this flexible API more complicated, because we would need to represent the varying number of arguments to your math function via some kind of Collection class.

    However, using the SmartClient API via JSNI is supported, and docs are here:

    https://www.smartclient.com/smartcli...gisterFunction

    If you are excited to use this capability but don't want to do the JavaScript part, we could do a very small Feature Sponsorship to provide SmartGWT wrappers, and also extend the system so that access to the current record and containing grid is easy and doesn't require a hack. And we could also build a shim so that you'd be able to use this on an existing release rather than wait for the next release.

    Comment


      #3
      Thanks, we may tryout the MathFunction, none of us noticed it in the API.

      Comment


        #4
        Hi bkelly,

        I did a similar thing another way, did not think of this possibility either.
        I wanted to highlight changes in a history table I created and check the differences to the same field in the previous row via SQL Window function.
        I used Hilites then to mark the changed entries.
        This is of course not configurable and if what you are doing works, it is of course way more elegant.

        Best regards
        Blama

        Comment

        Working...
        X