When right-clicking onto the ag-grid row, there is no Open in a new tab, since the row is not actually a link. Is there a way to make the entire row a link? so that right-click context menu can have the Open in a new tab option?
You could try using a cellRenderer:
cellRenderer: () => {
return `
<a style="display:block; width:100%;height:100%"
href="https://www.ag-grid.com/javascript-grid-cell-rendering/#cell-rendering"
hello
</a>`;
},
Now if you click on the cell it will have the option.
You will probably need to reuse this across all columns to enable this on the entire row.
Related
I need event on dragging column from tool panel ,
is any way to detect drag and move column from tool panel ?
thanks
Regarding ag-grid documentation found here https://www.ag-grid.com/javascript-grid-events/
var gridOptions = {
...
onDragStarted: function() {alert('Start move...')},
onDragStopped: function() {alert('End move...')},
...
};
Please note that both actions will be launched also on drag n drop event from global Columns header - I do not know if this will be an issue for you.
noobie_sapui5_developer
I am trying select single row of sap.ui.table with checkbox.
There are 2 modes for this table
Multi
Single
In multi selection mode there are checkboxes for each row and multiple rows can be selected - but I want only a single row to be selected
In single selection mode, it allows only a row to be selected - but there are no check boxes.
How to achieve a table with checkboxes with only one selectable row?
It is possible with sap.m.table, but my requirement is to make it work with sap.ui.table.
Why I wouldn't recommend doing this:
Checkboxes (selectionMode="MultiToggle") are usually used to signal the user that he's able to select no, one or more options, while radio buttons (selectionMode="Single") tell the user that he's only able to choose one option.
See: material.io, nngroup, uxplanet-radio, uxplanet-checkbox
In your case, I'd recommend using the selectionMode="Single" and either set the selectionBehavior attribute to Row, RowOnly or RowSelector (SelectionBehaviour).
As #jasbir pointed out, you could use the rowSelectionChange event in order to invoke a function that grabs the index (getSelectedIndex) of the row that was just selected. You can then call the setSelectedIndex function on the sap.ui.table.Table and pass it the grabbed index. This will remove previously selected rows and set the currently selected row as selected.
<Table id="yourTableId"
selectionMode="MultiToggle"
rowSelectionChange="onSelectionChange">
</Table>
And in the controller.
onSelectionChange: function(oEvent) {
var oYourTable = this.getView().byId("yourTableId"),
iSelectedIndex = oEvent.getSource().getSelectedIndex();
oYourTable.setSelectedIndex(iSelectedIndex);
}
Note: Since the setSelectedIndex function triggers a rowSelectionChange the above function gets triggered twice (another indicator that this solution isn't intended behaviour).
Check the SAP Fiori Guidelines for the sap.ui.table.Table for further information.
You can use rowSelectionChange event whenever a selection is changed you can unselect other rows and keep the selected one.
Hope this helps
Im using Ag-grid to control my table, but i want in my group that stores a list of rows instead of having to make the row group expand in 2 clicks, i want to be on 1 click.
If i click on the icon arrow it works, but if i click on the title row it only opens on 2 clicks.
I already tried to find in the documentation any information about it, but cant find nothing.
Here is a example from the documentation.
https://ag-grid.com/javascript-grid-tree/index.php
example image:
We are now recommended not to use the onGroupExpandedOrCollapsed, so this should now be...
This will also update the icons and animate the rows, which onGroupExpandedOrCollapsed won't.
onRowClicked(params) {
params.node.setExpanded(!params.node.expanded);
}
This will toggle the expansion, use params.node.setExpanded(true) if you want the rows to just stay open.
You can listen to events on either a row or cell clicked, and expand nodes accordingly.
For example to expand a row based on a click you could do the following:
onRowClicked: (params) => {
// update the node to be expanded
params.node.expanded = true;
// tell the grid to redraw based on state of nodes expanded state
gridOptions.api.onGroupExpandedOrCollapsed(params.rowIndex)
}
This should be in the documentation - I'll update it to reflect this information.
In the column definition, you can use the onCellClicked(params) function to tell it to do something when the cell is clicked. I tried looking for an expand function, but I could only find expandAll() which I don't think you will want. So what I would do is just use jquery or simple DOM selection to click on the expand icon inside of that cell.
this one works
onRowClicked(params) {
params.context.setExpand.onExpandClicked(params.rowIndex, params.node.rowHeight);
}
I want to be able to specify what column triggers the data-toggle event so I can have other columns respond to a different event with out toggling the data.
Here's a plunk that will show what I'm seeing: http://plnkr.co/edit/wqyuuqNfb6qxXBWyHoRo
All columns in a row except the first and last will show a modal dialog when clicked. When the screen is shrunk and the data is collapsed, the toggle icon is displayed on the first column. When you click this icon, the data is toggled as expected. The problem I have is when you click the first name, the data is toggled and then the modal is shown. Is there a way to restrict the toggle event to just the column that is specified?
I found an solution. Just add a trigger to collapse the expanded data as below.
$("table").on("click","td:not(.footable-first-column)",function(e){
var row=$( this ).parent();
$(row).trigger('footable_toggle_row');
$(".modal.fade").modal("show");
return false;
});
Please find the solution in this plunk: http://plnkr.co/edit/QRQyhvvSOmz5oDlR0Cph?p=preview
There was an update to https://github.com/bradvin/FooTable/issues/189#issuecomment-44100073.
I was using the answer by #Duli, but I think this works better.(I will keep his answer as the one I accepted)
When I initialize the table I add an option to change the toggleSelector and that causes the row to only toggle when the icon is selected and not the row.
$('.footable').footable({
toggleSelector: " > tbody > tr > td > span.footable-toggle"
});
How can I make this accordion generic? That is, instead of active:2 I want it to point to the next section(may be some function like next() or such...). Similarly, for previous section.
$('#accordion').accordion({collapsible: true, active:2});
Also once if it opens a section , is there a way to focus on the first or last input field of the section?
Any help is appreciated.
$("#selector").accordion({
change : function(event, ui) {
// Your code to expand the next section and/or select the first element
}
// There is also a changestart event you could use instead of change
});