I am new to Nebula Nat table, I have successfully created nattable in my application.
i have several columns one among them, one among them has a combo in it. i want to trigger a listener when ever there is change in the value of the cell . for example if i my combo box has value A and B. if change the value to A to B. i want to trigger a event and based on that event i want to change the value in the another cell.
I tired some of the listener nothing is comfortable, is there any listener in Nattable specific to cell. Because what ever the listener we have all specific nat table as a whole.
I analyzed more i found out that i can do capture selection in the cell using CellSelectionEvent. But what i need is to trigger whenever there is a change in the cell. but CellSelectionEvent triggers at the time of selection. Is there event i can use whenever there is a change in the cell.
With NatTable 1.6 the DataUpdateEvent was introduced for this.
Related
In ag-grid master detail functionality, i added checkboxes to detail grid when i check row in the first detail grid and then scroll to bottom grid and expand/collapse that grid, the checkbox in first grid is gone (not persisted).
https://plnkr.co/edit/UeWohlz76GM7B4L80n91?p=preview
<AgGridReact
columnDefs={this.state.columnDefs}
masterDetail={true}
detailCellRendererParams={this.state.detailCellRendererParams}
detailRowHeight={this.state.detailRowHeight}
defaultColDef={this.state.defaultColDef}
onGridReady={this.onGridReady}
getRowHeight={this.state.getRowHeight}
groupDefaultExpanded={1}
rowData={this.state.rowData}
/>
Checkbox values should be persisted in the first(top grid).
My Stack rep is not established enough to add a comment, but NOTE, this is not a solution - more comment.
Ag-Grid removes detail grid from the DOM when master grid collapses it. With this, there is no Ag-Grid state to remember what was checked for the collapsed detail grid. In a similar master-detail grid table for a project, this was solved by
maintaining local state of the detail grid selected rows (check one on/off, it gets added/removed from a local state array)
using the detail onGridReady method, invoke a function to programmatically go through each detail row node. I believe you can use GridApi's forEachNode method to do this
As you iterate through each detail node, utilize the detail node's unique ID to see if the same unique ID is stored in selected detail rows local state setup in Step 1. If so, use the node's setSelected method to turn it on
Does ag-grid support separating row selection from checked checkboxes?
My users need to select a row (click on it, or keyboard nav) to see further details about the row. Then they need to check the checkbox (or not) to select the row for later export to Excel.
So for example, they'll click every row to see the further details, but only check some of the checkboxes for later export. Is this supported?
If not, what would be a good approach to implement? Add my own checkboxes to the first column?
You can set suppressRowClickSelection to true when you want checkbox selection, and don't want to also select when the row is clicked. If true, rows won't be selected when clicked.
You can read more about this here - https://www.ag-grid.com/javascript-grid-selection/
You can use ag-Grids selection capabilities for the checkbox selection and then use the onRowClicked prop to do a different select on row click. I'm doing just this (but with onRowDoubleClicked.
You still want to set suppressRowClickSelection to true.
I am trying to create a UI using SWT in eclipse. I have a table with multiple rows and two buttons Start and Next.When I click on Start, the first row is supposed to get selected. When I click Next, the next row has to be selected. And when a row is selected I have to read the corresponding row data.
I tried using
tableViewer.getTable().setFocus();
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(0)),true);
But no row is getting selected.
I also tried with table.getSelection(0);
And now each row is selected but with grey colour.As a result the row selection is not invoking table.addListener().
Please help me with this. I am new to this topic.
Thanks in advance.
You might have missed
tableViewer.refresh ();
before doing setSelection
I want to change some fields every time my cellTable content changes (new row, row change). Is there any predefined event/handler for that?
See if addRangeChangeHandler or addRowCountChangeHandler in HasRows meet your needs.
If by "row change" you mean a change in selected row(s), you can use SelectionChangeHandler attached to a SelectionModel.
Otherwise, you can simply call whatever method you need when you add a row or update a data provider.
I already have a table - CellTable, with single selection model and i used onSelectionChange to find when row was clicked
Next I added to that column which containes check box
and here comes my problem
if i use single selection model, when i tick one row, other row become unticked
i tried to switch to multiselection model, but in this case, i can't click on row, and onSelectionChanges is executed only when i click on my check box, but i can tick more than one box
is any chance how i can have both - multiselection and clickable row?
regards
Yes it is possible.
But I am suprised that it doesn't work because the default behavior of the MultiSelectionModel should be that the row is selected as soon as you click it. However maybe in the presence of a CheckBoxCell column it is different.
Anyways you have to check following JavaDocs:
Constructor of the CheckboxCell
DefaultSelectionEventManager