How do I get the parent row index from a grid cell in Extjs? - extjs4

I have a CheckColumn in a GridPanel and I want to disable the editable cells of a given row if the checkbox on that row has been checked. Is this possible?

The easiest way to do this is to listen to the beforeedit event on the editor. Something like:
cellEditing.on('beforeedit', function(ed, context) {
return !context.record.get('checkField');
});

Related

How can I get a click on a row in a table in Cuba framework?

I have to detect a click in a row in a table in Cuba framework but I don't find how.
I have a TreeTable. Then I have a button. If I have nothing selected in the table, I want the button disabled. If I click on a item I want the button to be enabled. If I click on a sub-item, I want the button to be disabled.
It is possible, in the action of the button to use a:
trackSelection = true
That will work, but enabled the button too if I click on a sub-item.
Then The idea is, when anything is clicked on the table, then do something. I have only to track the selection of any item, and then do a logic.
How can I track this selection?
I have tried anything like:
table.setClickListener("columnId", new CellClickListener() {
#Override
public void onClick(Entity item, String columnId) {
// TODO Auto-generated method stub
LOG.info("On cell click");
}
});
First, that don't work, even if I click on a cell. Then even if it will work, I have the complete row and not only a cell.
Somebody have an idea?
Thanks
Best regards
You can react on selection change in Table using CollectionDatasource.ItemChangeListener:
employeesDs.addItemChangeListener(event -> {
log.info("Datasource {} item has been changed from {} to {}",
event.getDs(), event.getPrevItem(), event.getItem());
});
See also: https://doc.cuba-platform.com/manual-6.9/datasource_listeners.html

Hyperlink in pentaho cde table component

I have created a table component in Pentaho in which I add a column with a hyperlink of the format https://www.aaaa.com/id.
It correctly shows in the table.
Now I want to create another hyperlink in the same table, but it has format
https://www.aaaa.com/probe&bbbbb%20&bbb$probe2.
How can I make it show only the field and not the path?
I have achieved something similar but clicking anywhere in the row the page is opened while I want it to only open the hyperlink.
you have to write a function under click Action under advance property something like below.
tableData[e.rowIdx][1] is a column name where you have to specify the column where you have to specify the click event.
function testClick(e) {
var id = e.tableData[e.rowIdx][1];
window.open('/pentaho/api/repos/%3Apublic%3Asample%3Adashboards%3Aname.wcdf/generatedContent?p_site='+id,"_self");
}
also you can write CSS to put underline and hover change color.
also put below code for all the table columns where you don't want click event.
#tbl_waste_overviewTable tbody tr td:nth-child(2) {
pointer-events: none;
}
You should check the column name you want to achieve the click action on as below
function(obj) {
if(obj.category == 'Desired Column'){
// perform desired click action below
}
}

TornadoFX: Allow copying an item from a listview to clipboard

When an item in a listview is selected, I would like the user to be able to copy the content to the clipboard. How can I achieve that?
You could add a shortcut to the view like so
shortcut(KeyCombination.valueOf("Ctrl+C")) {
// Convert the selected item as you see fit and add it to the clipboard
// For example:
clipboard.put(MyCustomFormat, listview.selectedItem)
}

Modify cell content when row created in Rad grid

I have a rad grid dynamically created. I have a status column in database. When binding the value to the grid, I want to show a de-activate button when status is 0 and activate button when status is 1. Upon clicking the button, the status should change from active to inactive and vice versa? What should be the column type and how to write an event for the button click?
I have accomplished the same task as shown below :
GridButtonColumn btncol = new GridButtonColumn();
btncol.ButtonType = GridButtonColumnType.LinkButton; // setting ButtonType as LinkButton
btncol.DataTextField = "Active"; // setting DataTextField to first column in DataTable
this.RadGrid1.MasterTableView.Columns.Add(btncol);
Better example is given in following link :
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html

How to change font color of a dojo DataGrid row after a cell has been edited

I want to change the font color of a row after a cell in that row has been edited and set to a certain value.
myStore is the dojo.data.ItemFileWriteStore associated to the dojox.grid.DataGrid dataGrid.
I have written this:
myStore.onSet = function(item, attribute, oldValue, newValue) {
if (item.myField == myValue) {
var index = dataGrid.selection.selectedIndex;
dojo.style(dataGrid.getRowNode(index), "color" , "red");
}
}
but unfortunately this doesn't make any effect...
UPDATE: I added the following style property: "backgroundColor" : "red". Well, the background color of the row changes to red, but when the mouse moves away from the row, the color changes back to the default! It might be that some default event handlers restore the default styles...
The dojo.style line works if you call it by itself. Either your function isn't being called at all, the if's condition false or there is no row selected and you are getting an invalid number for the index. (You can put some console.logs there to check)