Closed vbabich closed 2 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?
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?
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
JsTable.applyFormatting(string[])
. Calls Table.formatColumns
with the string array provided. Table.formatColumnWhere
and Table.formatRowWhere
call Table.formatColumns
anyway, so really only need to call Table.formatColumns
formatRowWhere
functionality - would require knowledge of the value of ColumnFormattingValues.ROW_FORMAT_NAME
, which is __ROWFORMATTED
.setColumnRenders
as well, might be difficult/hacky to add that in later (cannot just be expressed as string)Option 2 - Building it similar to filters:
FormatValue format()
method on Column
FormatValue
class, with a ref to the columnJsTable.applyFormatting(FormatValue[])
, which ends up converting all the args to text and then passing to server to call Table.formatColumns
PROGRESS
that format can be set to?
class Column {
...
FormatValue format(String format) {
return new FormatValue(this.name, format);
}
...
}
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;
}
}
Slack call:
Color
/Decimal
/Date
, and formatSuffix depends on the format type*
appears to be a magic string that can be used when calling Table.formatColumns to mean "this is a row format column" (though this doesn't really help for directly invoking Table.updateView)Only thing remaining on this ticket is setColumnRenderers
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).