Posted 21 November 2017, 5:38 pm EST
Manish
I am doing that:
function editorWidgetBuilder($compile, $rootScope) {
///init code
build: function (grid, hostCell, row, col) {
var record = grid.getRowData(row);
var field = grid.getFieldData(row, col);
var efd = field.getEntityFieldDefinition();
var widgetScope = angular.element(hostCell).scope().$new(true);
widgetScope.cellValue = grid.getCellData(row, col, false);
var scopeProps = {};
scopeProps.grid = grid;
scopeProps.record = record;
scopeProps.field = field;
scopeProps.row = row;
scopeProps.col = col;
scopeProps.binding = grid.columns[col].binding;
scopeProps["widget-name"] = efd.inputType.name;
scopeProps["widget-params"] = efd.inputType.params || {};
scopeProps["host-cell"] = angular.element(hostCell);
scopeProps["default-editor"] = scopeProps["host-cell"].children("input:first");
var el = angular.element("<div fbt-editor-widget class=\"gridEditorWidget\"></div>");
el.attr(scopeProps["widget-name"], "");
el.attr("tabindex", "1");
el.attr("data-row", scopeProps.row);
el.attr("data-col", scopeProps.col);
el.attr("data-binding", scopeProps.binding);
el.attr("id", 'gridEditorWidget');
el.attr("ng-keydown", "editorWidget.handleDefaultKey($event)");
for (var i in scopeProps) {
if (scopeProps.hasOwnProperty(i)) {
el.attr(i, typeof scopeProps[i] == "object" ? $.camelCase(i) : scopeProps[i]);
widgetScope[$.camelCase(i)] = scopeProps[i];
}
}
var linkedTemplate = $compile(el)(widgetScope)[0];
hostCell.appendChild(linkedTemplate);
}
}
this gets from the itemFormatter
but the handlers cellEditEnding and roweditEnding for the grid also get fired when I click in the cell on the grid
How can I stop this from happening?
When I look at the callstack I see that the wijmo.grid.js file has fired the Control.prototype._updateFocusState->setTimeout->ctl.onLostFocus() method of the grid.
the ctl is the grid element.
I have another more simpler example with the latest libraries and I can’t replicate the issue in that project.
So how can I bind the injected html to the cell so the grid doesn’t lose focus?