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
Related
This might be a rather simple question to answer.
I'm using Ag-Grid with React (ag-grid community + enterprise)
I noticed that if I right click on a row and I select an action on the context menu that appears, it will apply the action to the row that was actually selected and not the one I right-clicked on. How can I select a row with a right-click?
I will add details of my code on demand if needed. Thanks in advance.
You can hook in cellContextMenu grid event and select the corresponding row as the first thing before proceeding to the rest of the logic. Something like this:
<AgGridReact onCellContextMenu={event => event.node.setSelected()}>
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.
In my Smartface app I have a dataset binded to a RepeatBox.
I am adding new row to the dataset from a function that is running ASYNCRONOUSLY.
I can perfectly see my new row within the RepeatBox but it does not scroll automatically to the new row. If all visible rows of the RepeatBox are filled then new rows come off the screen which is not very user-friendly.
Is there any way to move the RepeatBox to the last row (or to the top row)?
P.S.: moving binded dataset by seek() doesn't help - the RepeatBox stands still
Try this :
RepeatBox.setTopIndex(0, itemIndex, 100);
Use itemIndex as a variable that is incremented each time you add a new row to the dataset. You can calculate how many numbers of rows do you have, make the variable start from that number, not 0.
The values 0 and 100 can be changed according to your design. You can check the links below for information about repeatbox's properties and members :
http://docs.smartface.io/html/M_SMF_UI_RepeatBox_setTopIndex.htm
http://docs.smartface.io/html/AllMembers_T_SMF_UI_RepeatBox.htm
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
hello friends
i am displaying data in telerik radgrid and i want to add a autocomplete text box with query button to select the particular row using one column for binding.
Can any one provide me a hint?
it has been almost a complete day but im getting no help.
How about using the solution from here? There is a textbox in the command item which filters the records by specified column values (the column is chosen from a dropdown beside the textbox).