2 issues with onEditCell

We have 2 issues with onEditCell :

(1) The documentation on docs.dhtmlx.com/api__dhtmlxgrid … event.html explains that returning “true” confirms the edit, and that returning a value (such as newValue) sets the value.

However, returning true does not result in a confirmed edit
Nor does returning newValue set the value.

We have found a workaround for confirming the edit (but not for setting the new value): the edit is confirmed when the function throws anything (we throw true).

(2) We are unable to let the user switch the value of a checkbox in a ‘ch’-typed column when onEditCell is defined.
Whether onEditCell returns something or throws something
Whether onCheck is defined or not
The checkboxes are ineditable when onEditCell is defined on the grid.

Are we missing something?

[code]

Test



table { border-collapse: collapse; }



Test







var testGrid;
var testNewAutoId = -1;

        function testGridAddRow() {
            testGrid.addRow(testNewAutoId, "Default A,Default B,0");
            testNewAutoId = testNewAutoId - 1;
        }

        function testGrid_onEditCell(stage, row, column, newValue, oldValue) {
		if (row >= 0 && row < 2) {
			return false;
		}
		else {
			if (stage == 2) {
				if (column == 2) {
					throw true; // Does not work
				}
				if (newValue != oldValue) {
					testGrid.cells(row, column).cell.style.fontWeight = "bold";
					// Documentation on https://docs.dhtmlx.com/api__dhtmlxgrid_oneditcell_event.html explains that returning "true" confirms the edit, and that returning a value (such as newValue) sets the value.
					// return newValue; // Does not work
					// return true; // Does not work
					// However, only throwing an error works for comfirming the edit
					throw true;
				}
			}
			return true;
		}
        }

        function testGrid_onCheck(row, index, state) {
		alert('testGrid_onCheck of row id ' + row + ' with index ' + testGrid.getRowIndex(row));
        }

	testGrid = new dhtmlXGridObject('test_grid_with_scrollbar_and_headers');
	testGrid.setImagePath('./imgs/');
	testGrid.setColumnMinWidth(100, 0);
	testGrid.setHeader('Text A, Text B, Ch C');
	testGrid.setInitWidths('300,300,100');
	testGrid.setColAlign('left,left,center');
	testGrid.setColTypes('ed,ed,ch');
	testGrid.enableAutoWidth(true);
	testGrid.enableAutoHeight(true);
	testGrid.init();
	var testData = {
		rows: [
			{ id: 0, data: ["Data A0", "Data B0", 1] },
			{ id: 1, data: ["Data A1", "Data B1", 0] },
			{ id: 2, data: ["Data A2", "Data B2", 1] },
			{ id: 3, data: ["Data A3", "Data B3", 1] }
		]
	};
	testGrid.parse(testData, "json");
	testGrid.attachEvent('onCheck', function (row, index, state) { testGrid_onCheck(row, index, state); } ); // Only works if next onEditCell is not attached.
	testGrid.attachEvent('onEditCell', function (stage, row, column, newValue, oldValue) { testGrid_onEditCell(stage, row, column, newValue, oldValue); });
</script>
[/code]

Please, try to use:
testGrid.attachEvent(‘onCheck’, testGrid_onCheck);
testGrid.attachEvent(‘onEditCell’, testGrid_onEditCell);
instead of
testGrid.attachEvent(‘onCheck’, function (row, index, state) { testGrid_onCheck(row, index, state); } );
testGrid.attachEvent(‘onEditCell’, function (stage, row, column, newValue, oldValue) { testGrid_onEditCell(stage, row, column, newValue, oldValue); });

Thanks. It works now.

I am having same issue. I have added both events as
reminderGrid.attachEvent(“onCheck”, onCompletedCheck);
reminderGrid.attachEvent(“onEditCell”,editReminderNotes);

The check box is now un click-able. Check box function was working well before adding onEditCell function. Now, it’s not. Edit cell is the only function which is working now. Could you please help me? It’s urgent. Thanks.

Got the solution… onEditCell event overrides onCheck event