I have a JavaFX TableView with some columns and some rows. Each column has a custom TableCell to be edited, for example: some columns use text fields, some others use check boxes, choice boxes and so on.
What I want is to edit several cells (simultaneously) in the same column by doing the following:
Select some rows in the TableView.
Click on a cell using the right mouse button.
A context menu is shown with the option "Edit All"; choose it.
Somehow I edit one of those cells and every cell in the same column whose row is selected commits the same value.
What I want to know is whether it is possible for every cell to “commitEdit” the same value. I cannot find the way of doing it.
Thanks in advance.
Related
I have a JTable whose every cell contains a JList. What I want to do is to make that table editable so that every item on the JList can be edited either using a JTextfield or Choosing an item from another List whenever the user right clicks on that list item in a particular table cell. I also want 2 of my table column need to be set uneditable. Here is a picture of my JTable. I want the every cell and every JList item on that cell to be editable leaving the 'Batch' and 'Break' column to be uneditable.
P.S. I don't want any spoon fed code. I just want an idea how it can be done. And I'll be really grateful if you can reference me some link on the web where I can read to learn how this type of problems can be solved. Thank you..!
enter image description here
I have an Eclipse SWT table. It contains multiple rows (with row headers) and multiple columns (with column headers). On click on a column header I want to deselect all rows and highlight only the column's header (or all cells of this column). Is that possible?
I already registered a listener for the column header's selection and am able to set the selection to the given column, but then it also always selects the first row automatically. I tried with SWT.FULL_SELECTION and SWT.SINGLE as the style of my table, but it only changes the way how the row is highlighted, but I want only to highlight the column's header (or optionally all cells of this column) and no rows.
Is it possible? Did anyone have the same problem?
I ran into the same problem and I'm afraid you can't do that in SWT.
I solved by imitating the selection of a column; I colored the cells as if they were selected, and dropped the "real" selection.
You should extend your own TableViewer and override the getSelection() method to reflect that you now also have this imitated kind of selection.
(And from a UX perspective, you should make sure that a copy command (i.e. Ctrl+C) behaves as users expect it.)
I want to create a table (that will finally exist in a new eclipse view). This table has a few text columns, and a column that has a different behavior based on the other columns. It can either be a field to enter text, or to popup a dialog for users to select data from (and it has to be a popup or a dynamically created combo). Anyway, I know which of the two I need for each row in the column.
My table is built using TableViewer and a few TableViewerColumn's in it. I later fill them with String data in TableItem's up to 4 columns. The fifth is the one I have this special behavior.
I tried experimenting with TableEditor, but failed:
When I used one for each TableItem it somehow got misaligned with the table rows and columns
When I use one for the entire table, I fail to set a Text entry on specific rows
What I need help with is figuring out exactly how to achieve this:
A Table that has 4 String columns, where the data is constant (cannot be changed by the user)
A fifth column where the cell contents is either a Text for the user to enter, or a (preferably transparent) Button that has a popup as action, or a Combo that I dynamically fill with data upon table creation
Any idea would be highly appreciated.
OK, got this figured out. The example here helped a lot:
http://www.java2s.com/Tutorial/Java/0280__SWT/TableCellEditorComboTextandButton.htm
Oren
I am using smartGwt 4.0, ListGrid allows us to add multiple columns with auto generated checkbox selection. I am using below property to get checkboxs for each record in the grid,
listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
I have many columns in the ListGrid so it comes with horizontal scrollbar, when i try to scroll to the right side, the selection checkbox column gets scrolled and after verifying mutil column values user has to scroll all the way left to select the record, this is bit annoying, is there a way to freez the checkbox column in ListGrid...?
yes you can do it using ListGridField#setFrozen().
whether this field should be "frozen" for the purposes of horizontal scrolling.
sample code:
listGridField.setFrozen(true);
--EDIT--
Try with ListGrid#freezeField() or other equivalent methods.
For detailed information have a look at FrozenFields
If it doesn't work then add your checkbox column instead of using default checkbox selection appearance and now make it frozen.
I have a JTable consisting of multiple rows and columns. I want to make the cells selectable, but only in one row at a time. So for example, when I click on the cell in third row and the fifth column, I can pull the mouse to the left or right and select more cells, but only in this specific row and not in the row above or below.
How can I do this?
Use the setSelectionMode() method from ListSelectionModel interface, and set the selection mode to ListSelectionModel.SINGLE_SELECTION.
This will configure JTable to work with one row at a time selection, blocking selection of multiple rows.
To select single cells, combine the above with setColumnSelectionAllowed(true) on TableColumnModel, and you should get what you need.