Excellent, just what I was looking for!
I do have a couple of quick follow-up questions on this portion of your code:
var initeditor = function (row, cellvalue, editor, celltext, pressedChar) {
if (pressedKey == '-') {
editor.val('-');
setTimeout(function () {
editor[0].setSelectionRange(1, 1);
}, 100);
}
pressedKey = null;
};
1) why use setTimeout()
instead of just setting the editor’s value?
2) why use editor[0].setSelectionRange(1, 1);
instead of editor.setSelectionRange(1, 1);
? Why is the index [0]
needed?
Thanks again.