Requests for JS Properties

I suggest that we use this topic to request adding simple events and properties to JS API that already exist in Dart but have not yet been exposed to JS. To begin with here are a few items:

  1. Add “length” property to GridColumnList to be consistent with ColumnList
  2. Add “left” and “right” properties to GridColumn
  3. Add “rowHeight” property to Grid
  4. Add “columnHeaderHeight” property to Grid
  5. Add onViewerAdded, onViewerClosed events to Events class
1 Like

Good idea to keep these simple requests in one topic! We’ll add them soon. By the way, rowHeight and colHeaderHeight properties are already available via the viewer properties:

let grid = grok.shell.addTableView(grok.data.demo.randomWalk(100, 100)).grid;
grid.setOptions({
  rowHeight: 30,
  colHeaderHeight: 150
});

We have also added the rest of the getters and events to GridColumnList, GridColumn, and Events classes. This will be available in the next build.

1 Like

Thank you for exposing the requested properties and events! Regarding rowHeight and colHeaderHeight, yes, they can be set using grid’s options, but reading their values is complicated. The getOptions() method of the Grid viewer returns a string that needs to be parsed. It would be much easier to have those two as normal read/write class properties.

Thank you for adding the requested properties! However the “left” and “right” properties of the GridColumn class only provide the corresponding getters. Could you please add the setters as well?. This is fundamental for our continuous zoom feature to function properly.

The width and height properties have setters, so you can control the left and right auto-calculated properties this way.

Dialog is an extremely useful component in the UI class that we use for different purposes. Could you please extend its JS API to enable some extra functionality like

  1. reposition on the screen (moveTo(x,y)),
  2. the ability to hide the Cancel button
  3. the ability to receive event on Cancel button click

Done! In addition to the requested features, we’ve also added the ability to specify context actions. Here’s the snippet that demonstrates the new functionality:

var dlg = ui.dialog('Windows');
dlg
  .add(ui.span(['People of Earth, your attention, please… ']))
  .onCancel(() => grok.shell.info('Cancel'))
  .onOK(() => grok.shell.info('OK!'))
  .addButton('HIDE', () => $(dlg.getButton('CANCEL')).hide())
  .addContextAction('My Action', () => grok.shell.info('Action!'))
  .show({x: 300, y: 300});

Could you please add isVirtual property to the Column class? This property should return ‘true’ when a column was created using the addNewVirtual() method:

dframe.columns.addNewVirtual

I believe this property is already in the latest version (available on dev) :slight_smile:

In the Dialog class onClose is a “get” property unlike onOk and onCancel which are handler functions.
Could you please either make onClose to be a function or add a “set” counterpart so that a listener could be installed? Either way is fine, but for consistency reasons making it a function would be preferable.