Working with a NatTable, I would like the following behavior:
Single click on an unselected, editable cell - cell is selected
Double-click on a cell (at any time), do custom open action
Single-click on a selected cell triggers an edit
Do I need to write a custom IEditableRule that checks selection? If there a way to check the selection from w/i this rule, or do I need to also create a rule that can listen to the entire table selection and unify these concepts?
You need to register custom bindings for editing. The default bindings are registered via DefaultEditBindings. You need to replace them with bindings for double click to open the editor and some customized actions that check the selection. For the key bindings NatTable uses the same approach. It is not the default to check the selection because of abstraction and it should be possible to edit even if you have no SelectionLayer in place.
To check if the cell is selected you either need a reference to SelectionLayer or check the DisplayMode of the cell. Never tried to use a IEditableRule for this.
Maybe these posts give you some more information:
https://www.eclipse.org/forums/index.php/t/452759/
Stop NatTable from going into edit mode when an editable cell is left-mouse-clicked
Related
Documentation addresses only the event handling https://adazzle.github.io/react-data-grid/#/examples/cell-selection-events.
Are there any CSS classes that are assigned to the selected cell? Currently the selected cell has pale blue border but I would like to change this. Such change of style is not possible with ReactDataGrid.onCellSelected, because the formatter.render() event is fired first and only then onCellSelected event is fired. Yes, I can read the coordinates of the selected cell in onCellSelected, but I can not use those coordinates for formatting, because formatter.render() is executed before onCellSelected, i.e., coordintates of new newly selected cell are not available in the time moment when they should be read.
I do not consider this as bug, of course, there should be another mechanism how one can format the selected cell, but at present I can not find this mechanism in documentation. I went through the generated code in web console and I did not managed to find any additional class name that could have been added to the selected cell by the grid.
So, what is the right mechanism how to format the selected cell?
Maybe I can call (somehow) formatter.render() of the selected cell inside onCellSelected somehow? And that would solve my issue?
Is there a way to add a custom column menu tab with my own favourite icon which on click would render my custom react component?
something like
myColDef.menuTabs: ['generalMenuTab', 'filterMenuTab', 'myCustomMenuTab']
FYI I'm using v12.0.2
What you're after can't be done I'm afraid. The grid supports React components in all sorts of ways (renderers, editors, filters etc), but not via the column menu.
I've updated the docs page to remove the gibberish issue - it'll be fixed properly in the next release, thanks for highlighting this.
This would be helpful to have. In particular for us, we'd like to filter based off row properties, and not row values. Creating our own tab to filter by cell colors that we have assigned with our own set of labels would be useful.
I agree that it would be a nice feature to have. Apparently, there's no quick out-of-the-box solution to do it. The only workaround I see is to implement your own custom Header component which would display any buttons your want.
There you can put a button to open your own custom menu, which you can implement as any regular UI component. It also means you'll need to manually implement all standard menu options that Ag-Grid provides out of the box if you need them.
I need to put an HTML code on dragging event. Like there is some HTML text that gets dragged with Cursor.
By default first column of ListGrid goes with Cursor. But I want to generate separate Text for it.
So, is it possible to do that?
Or Is there any other option to do that?
Please help me in this.
Thanks.
Whats displayed (by default) during a drag event in ListGrid is defined by ListGrid.dragTrackerMode and ListGrid.titleField.
ListGrid will default to first field to obtain the description to be shown during a drag, based on titleField.
If you already have another field in the grid from which you can obtain the text, use listGrid.setTitleField("other-field-name");
A custom title can be defined by overriding ListGrid.getDragTrackerTitle
If multiple records are selected, and dragged, drag tracker/title/etc. will be based on first selected record.
Check other ListGrid methods that allow drag tracker customizations as well.
I want to make my gtk.CellRendererPixbuf in the treeview clickable so that I can call a function when user clicks on it. Is this possible and how can this be done?
I'm working with PyGTK, but answers in C or PHP or anything else would be acceptable. Thanks.
The C documentation of GtkCellRenderer states that:
Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be activatable like GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be editable like GtkCellRendererText, which allows the user to edit the text using a GtkEntry. To make a cell renderer activatable or editable, you have to implement the activate or start_editing virtual functions, respectively.
What is unfortunate is that this information is missing from the pyGTK documentation, but the information is available in the activate signal documentation.
I have a CellTable with a bunch of cells that render to <input> tags. Tabbing between the inputs is broken because of CellTable's fancy event processing. It seems that tab inspires each cell to finishEditing, but that in turn hogs the focus and the focus never gets to the next <input>.
Setting tabIndex on each input does not seem to affect the behavior.
How can I restore the usual tabbing functionality?
I recently figured this out. Annoying, but simple once you find the magic.
Create a new Cell type to use in your table, as the stock TextInputCell specifies a tab index of -1. Basically do everything that TextInputCell does, but dont specify any tab index in your template.
Disable the default keyboard navigation on your CellTable. cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED)
This should result in a normal tab navigation in your CellTable.
Disabling KeyboardSelectionPolicy may not work on all views, if you are using any MVP frameworks. GWT selects the cell instead of the input field within the cell.
Here is a solution which I used in my applications: Adding TAB control to GWT CellTable
the solution from Ben Imp works fine if you dont change the value of the cell, but if you change the value and try to navigate with tab to the next cell it lost focus and starts with the first element of the view. I have not found a solution for this inappropriate behaviour.
For those looking at this in the future trying to figure out how to have tabbing while changing values, do what the Ben Imp suggests then also in your custom components remove any reference to super.finishEditing. In some cases this means overriding finishEditing and having it do nothing.