deephaven / deephaven-core

Deephaven Community Core
Other
254 stars 80 forks source link

Expose conditional formatting methods in JS API #1324

Closed vbabich closed 2 years ago

vbabich commented 3 years ago

In order to implement conditional formatting menu in the Web UI we need to expose the following formatting methods in JS API: formatColumns, formatColumnWhere, formatRowWhere, setColumnRenderers (for progress bar format).

mofojed commented 3 years ago

@vbabich / @dsmmcken : What do we need these APIs for? I'm looking at the Conditional Formatting impl in Swing, and it appears to be entirely client side (unless I'm missing something). Why do we need this API?

dsmmcken commented 3 years ago

It's client side in swing? Probably easier to accomplish client side in java then in js. We don't do client side anything, and would need to re-implement all the comparisons and query parsing for all column types, including datetimes, bigints, etc. Also, formatting can support any valid query condition, like Spread / Ask * 100.0000 > Last, do you really want to be computing that client side?

mofojed commented 3 years ago

I misunderstood some things previously, now I see what's going on. Basically need to wire some functionality through JsTable to call Table.formatColumnWhere, Table.formatRowWhere, Table.formatColumns. We could do this a couple ways (could use @niloc132 's and @vbabich 's input here).

Option 1 - Passing string array

Option 2 - Building it similar to filters:

class JsTable { ... void applyFormatting(FormatValue[] formats) { ... } ... }

class FormatValue { static rowFormat(String format) { return new FormatValue("__ROWFORMATTED", format); }

String columnName; String format;

FormatValue(String name, String format) { this.columnName = name; this.format = format; }
}

niloc132 commented 3 years ago

Slack call:

mofojed commented 2 years ago

Only thing remaining on this ticket is setColumnRenderers