Topic
  • 3 replies
  • Latest Post - ‏2013-03-18T09:46:19Z by Kendall.Coolidge
SystemAdmin
SystemAdmin
6195 Posts

Pinned topic DataGrid selectionListeners stop working when using DataGridTooltip

‏2011-07-08T14:15:01Z |
When I enabled the DataGridTooltip, the selectionListeners row clicked event stops working. I copied this code right from the help, added a selectionListeners = GridRowClicked and a function which simply does a writeStdOut. If I uncomment the line "behaviors =http://myDataGridToolTip.setToolTips, " the selectionListeners row click event stops working. Comment it out and it works again. Anybody see what I'm doing wrong?

Thanks,
Daniel

package myPkg;

import com.ibm.egl.rui.widgets.Box;
import com.ibm.egl.rui.widgets.DataGrid;
import com.ibm.egl.rui.widgets.DataGridColumn;
import com.ibm.egl.rui.widgets.DataGridLib;
import com.ibm.egl.rui.widgets.DataGridTooltip;
import com.ibm.egl.rui.widgets.TextArea;
import egl.ui.rui.Widget;

record Stock type BasicRecord
Symbol string;
Quote decimal(5, 2);
NumShares int;
end

handler MyDataGrid1 type RUIhandler{initialUI =grid, onConstructionFunction = start}

stockList Stock[] =[
new Stock{Symbol = "Company1", Quote = 100.00, NumShares = 40},
new Stock{Symbol = "Company2", Quote = 200.00, NumShares = 10},
new Stock{Symbol = "Company3", Quote = 100.00, NumShares = 40}
];

grid DataGrid{data = stockList as any[],
// behaviors =http://myDataGridToolTip.setToolTips,
selectionListeners =GridRowClicked,
selectionMode = DataGridLib.SINGLE_SELECTION, // MULTIPLE_SELECTION (the default), SINGLE_SELECTION, DISABLE_SELECTION
pageSize = 15,
columns =[
new DataGridColumn{name = "Symbol", displayName = "Symbol Display"},
new DataGridColumn{name = "Quote", displayName = "Quote Display"},
new DataGridColumn{name = "NumShares", displayName = "NumShares Display"}
]};
myDataGridTooltip DataGridTooltip{provider = tooltipText, tooltip.delay = 1000};

function start()
end

function tooltipText(rowData any in, fieldName string in, td Widget in) returns(Box)
tooltipArea TextArea{width = 450, height = 100, paddingLeft = 7, marginLeft = 7};
tooltipBox Box{columns = 1, width = 475, children =tooltipArea};
tooltipArea.text = "In function tooltipText (a tooltip provider):" +
"\n fieldName is the column name ('" + fieldName + "')." +
"\nYou can access cell content:" + "\n td.innerText is '" +
td.innerText + "'. \nThanks to EGL dynamic access" +
"\n rowDatafieldName is also '" + rowDatafieldName + "'.";
return(tooltipBox);
end

function GridRowClicked(grid DataGrid in)
selectedRow Stock[];
selectedRow = grid.getSelection() as Stock[];
numberOfRows int = selectedRow.getSize();
if(numberOfRows > 0)
for(i int from 1 to numberOfRows)
sysLib.writeStdOut("Symbol " + selectedRow[i].Symbol + " is selected.");
end
end
end
end
Updated on 2013-03-18T09:46:19Z at 2013-03-18T09:46:19Z by Kendall.Coolidge
  • HuangJiYong
    HuangJiYong
    116 Posts

    Re: DataGrid selectionListeners stop working when using DataGridTooltip

    ‏2011-07-11T07:37:26Z  
    Hi Daniel,

    Can you try this:
    1. Go to the rui widgets project such as com.ibm.egl.rui_3.0.0 (the version number may be different in your workspace). Open com.ibm.egl.rui.widgets.Tooltip.egl
    2. Find the enable function in Tooltip.egl
    function enable(widget any in)
    target Widget = widget;
    target.onMouseOver ::= activateTooltip;
    target.onMouseOut ::= deactivateTooltip;
    target.onClick ::= leaveTooltip;
    end
    3. Comment out the onClick line
    function enable(widget any in)
    target Widget = widget;
    target.onMouseOver ::= activateTooltip;
    target.onMouseOut ::= deactivateTooltip;
    // target.onClick ::= leaveTooltip;
    end
    4. Refresh, clean the projects and load the test case again.

    Regards,
    • Jiyong
  • SystemAdmin
    SystemAdmin
    6195 Posts

    Re: DataGrid selectionListeners stop working when using DataGridTooltip

    ‏2011-07-11T14:45:44Z  
    Hi Daniel,

    Can you try this:
    1. Go to the rui widgets project such as com.ibm.egl.rui_3.0.0 (the version number may be different in your workspace). Open com.ibm.egl.rui.widgets.Tooltip.egl
    2. Find the enable function in Tooltip.egl
    function enable(widget any in)
    target Widget = widget;
    target.onMouseOver ::= activateTooltip;
    target.onMouseOut ::= deactivateTooltip;
    target.onClick ::= leaveTooltip;
    end
    3. Comment out the onClick line
    function enable(widget any in)
    target Widget = widget;
    target.onMouseOver ::= activateTooltip;
    target.onMouseOut ::= deactivateTooltip;
    // target.onClick ::= leaveTooltip;
    end
    4. Refresh, clean the projects and load the test case again.

    Regards,
    • Jiyong
    Hi Jiyong,

    That fixed it. I've implemented this change in my actually application and the DataGridtooltip and selectionListeners both work now. I've done some brief testing, and I don't see any negative impact from this change.

    Thank you for your help.
    Daniel

    RBD 8.0.1.1
    RUI
    com.ibm.egl.rui_3.0.0
  • Kendall.Coolidge
    Kendall.Coolidge
    84 Posts

    Re: DataGrid selectionListeners stop working when using DataGridTooltip

    ‏2013-03-18T09:46:19Z  
    Hi Jiyong,

    That fixed it. I've implemented this change in my actually application and the DataGridtooltip and selectionListeners both work now. I've done some brief testing, and I don't see any negative impact from this change.

    Thank you for your help.
    Daniel

    RBD 8.0.1.1
    RUI
    com.ibm.egl.rui_3.0.0
    FYI: This is still a problem in RBD 8.5.1.

    The fix mentioned still works, but it means having to modify the IBM widgets. Will a fix be included in a future release or fixpack?

    Thanks,
    Kendall