If the grid has Selection and Updating, setting the startEditTriggers doesn't work. Only double-clicking will work to initiate edit mode. Click or F2 will not.
grid.igGrid( { columns: buildColumns(), features: [ { name: "Sorting", type: "local" }, { name: "Selection", mode: "cell", multipleSelection: false, activation: true, cellSelectionChanged: function (evt, ui) { var actualRowIdx = ui.cell.row[0].rowIndex - 1 // rowIndex is not zero based (and varies both on naming standard and zero-base depending on which event is being used [good times indeed]), but methods expect a zero-based index if (ui.cell.columnKey === 'NextRound') { var myCell = grid.igGridSelection('getCellValue', actualRowIdx, 'NextRound'); var dataview = grid.data('igGrid').dataSource.dataView(); var myVal = dataview[actualRowIdx]["NextRound"]; grid.igGridUpdating("setCellValue", actualRowIdx, 'NextRound', !(myVal)); dataview[actualRowIdx]["NextRound"] = !(myVal); grid.igGridSelection('deselectCell', actualRowIdx, ui.cell.index); grid.igGridUpdating('endEdit'); grid.igGridSelection("clearSelection"); } else { // grid.igGridSelection('selectCell', actualRowIdx, ui.cell.index ); grid.igGridUpdating('startEdit', actualRowIdx, ui.cell.index); } } }, { name: 'Updating', editMode: 'cell', enableAddRow: false, enableDeleteRow: false, validation: true, startEditTriggers: 'click,dblclick,enter', editCellEnded: function (evt, ui) { //NOTE: editCellEnded likes attention, it also likes to fire when entering edit mode on a cell }, editCellEnding: function (evt, ui) { //TODO: check valid value (number, not used previously, not more than # of competitors) & return false with alert if not ok if(ui.value!='' && isNaN(ui.value)){ alert('Not a valid scoring number'); //evt.stopPropagation(); evt.stopImmediatePropagation(); evt.preventDefault(); return false; //NOTE: see the mighty "editCellEnding" in action, its event propagation is unstoppable
} } }], width: "100%", dataSource: CompetitionRound.RoundCompetitors, autoGenerateColumns: false, renderCheckboxes: true });
Is there no better solution for this as of yet?
I also can't seem to get this working in the 2015.2 release (with the knockoutjs grid).
http://jsfiddle.net/2pgc4zqr/
You still have to click twice to be able to edit the input field.
Hello again,
In addition to my last solution, you can use one line of JavaScript code to enter edit mode with a single click. Here is the magic:
cellClick: function(evt, ui) { $("#grid1").data("igGridUpdating").startEdit(ui.rowIndex, ui.colIndex, evt); },
Hello from me,
We have a solution for single click editing and updating with checkbox.
Please use the following code:
I would have assumed "click" would have overrode "dblclick", regardless though, simply putting "click", or "enter" or "F2" all fail. "enter" fails oddly by moving the selection to the next row and placing the cell under the one that had focus into edit mode rather than the focused cell.
I will say again: "click" even by itself, fails.
Regarding the checkbox, yes I understand what you're saying, but the logic behind that way of thinking is obviously wrong and the explanation just seems to justify a poor design, poor user experience, poor use cases, poor planning. I'd suggest you check out some competing products or even the old UltraWebGrid. It's universally understood that clicking a checkbox should check it. The igGrid is the only place I've ever seen where you have to click through 3 clicks to get it checked and if you tried to explain it as needing 3 clicks to any end user they'd think you were crazy. 2 clicks without selection is still ridiculous. What may be worse is the defense of it as supposedly logical and normal - and something I should expect elsewhere. Even your own WebDataGrid checkbox sample ( https://ko.infragistics.com/samples/aspnet/data-grid/unbound-checkbox-column ) only requires a single click to check it - if the logic you related was valid I would have expected the WebDataGrid to adhere to it as well.In that sample, I had tried a myriad of ways to get the event canceled and have the cell in question remain selected and in edit mode. Those were just left in place while I researched other outstanding and crippling shortcomings of the igGrid. Simply returning false doesn't stop the focus from moving to the next cell or exiting edit mode.
Hi revbones,
The description of startEditTriggers did not include notes that if "dblclick" is included in triggers, then "click" has no effect.Logic of updating assumes that is application included "dblclick", then possible "click", which might remain from default setting, should be ignored. The description of that option was adjusted for that rule.If your application needs to start edit mode on a single click and on F2, then I suggest you to set value of that option to "click,F2".
If both selection and updating are enabled, then editing can be started on for already selected cell/row. If editing would be started on first click over unselected cell, then it would be impossible only to select cell without start editing. End user would not be able to just navigate selection through cells of grid.That means that editing can be started only by 2nd click on the same cell.
The checkbox cell editor is exactly the same as all other cell editors. Its value can be modified only when it gets focus. Therefore, in order to toggle checkbox, end user should click 3 times on it.
If selection is disabled, then 2 clicks on checkbox are required. However, if state of checkbox was modified, then mouse click on another cell will not start edit-mode for clicked cell/row, because at that point editor loses focus, dataSource is updated with modified data and grid is rerendered to reflect changes. Therefore, if that click happens to be on another checkbox-cell, then changing its state will require 3 clicks.
I noticed that in your sample you try to cancel event by stopPropagation, preventDefaults, etc. That will not cancel event, but only may break functionality. In order to cancel action of cancelable event, application should return false from handler. Canceling events raised by widgets includes only documented actions. In case of editCellEnding, that will only cancel update of data. If intention of application to continue editing, then that will not work. Note: in current version, the cell-editor is removed from document before editCellEnding is raised.
In currently available version, only editRowEnding supports special member/property "keepEditing" for 2nd ui parameter in event handler. Recently similar option was added to the editCellEnding, which will be available only for editMode="cell". Future service releases will have that option.
I hope that I explained logic/rules used by igGridUpdating and igGridSelection. If I missed something, then I will be happy to clarify my answers and replay on other questions.