:: Forum >>
cannot cancel edit with complex selector
i have a fairly complex grid that can be edited. I also have an input field for each row in the selector.
i click on a cell to edit, enter new text. everything is fine. then i go to the input on the selector. if i type in anything, the grid cell is being edited instead.
i played with onSelectorClicked, onSelectorMouseDown but so far nothing has worked. i also tried calling cancelCellEdit() but it says its not a function?
here is the code that demonstrate this - modified from quickref:
<html>
<head>
<title>ActiveWidgets Examples</title>
<script src="../../runtime/lib/aw.js"></script>
<link href="../../runtime/styles/system/aw.css" rel="stylesheet"></link>
</head>
<body>
<style>
#myGrid { width: 400px}
#myGrid .aw-grid-row {height: 20px; border-bottom: 1px solid #ccc}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
/* Alternate row colors */
#myGrid .aw-alternate-even {background: #fff;}
#myGrid .aw-alternate-odd {background: #eee;}
</style>
<script>
var myData = [
['MSFT','Microsoft Corporation', '314,571.156', '32,187.000', '55000'],
['ORCL', 'Oracle Corporation', '62,615.266', '9,519.000', '40650'],
['DOX', 'Amdocs Limited', '4,288.017', '1,427.088', '9400'],
['CTXS', 'Citrix Systems, Inc.', '3,946.485', '554.222', '1670'],
['KNM', 'Konami Corporation', '3,710.784', '.000', '4313']
];
var myHeaders = ["Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"];
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
obj.setCellEditable(true);
obj.setHeaderText(myHeaders);
obj.setCellText(myData);
obj.setColumnCount(5);
obj.setRowCount(5);
obj.setSelectorVisible(true);
obj.setSelectorWidth(55);
obj.setRowHeight(25);
var rc = 1; // put a text input field on the selector
for (var i=0; i< 5; i++)
{
textStr = "<input type=text size=2 id='ord" + i + "' value='" + rc*10 + "'>";
obj.setSelectorText(textStr, i);
rc++;
}
document.write(obj);
// set the color if edited
obj.onCellTextChanged = function() {
obj.getCellTemplate(this.getCurrentColumn(), this.getCurrentRow()).setStyle("color", "red");
};
</script>
</body>
</html>
any idea what i can do? i am using 2.5
mango
Wednesday, May 7, 2008
Ca I suggest using AW.UI.Input instead of normal HTML-INPUT ?
Just an idea, I would do...
var rc = 1;
for (var i=0; i< 5; i++){
textStr = new AW.UI.Input;
eval("textStr.onControlEditEnded = function() { alert('Leaving input row # ' + "+i+")}");
textStr.setStyle('width', '83%')
obj.setSelectorText(textStr, i);
rc++; }
HTH
Carlos
Wednesday, May 7, 2008
thanks carlos,
i tried using AW.UI.Input does not make any difference. the same behaviour - if i click on a cell first, then click on the UI.input field then type, the new chars goes into the grid cell still
mango
Thursday, May 8, 2008
I can not reproduce it with UI.Inputs -(
I commented the : eval....alert... line but the only issue under Moz is the missing blinking cursor.
Anyway I just test it on xp, IE6 & Moz2.0
Carlos
Thursday, May 8, 2008
AHHHH thanks i tried UI.input in the stand-alone sample above and it works fine.
in my program with my complex grid it still have the same problem. my grid has check boxes, combos inside the grid with ajax calls etc. not sure what caused it.
mango
Thursday, May 8, 2008
This topic is archived.
Back to support forum
Forum search