Open
Description
I am building a directive to copy & paste data from clipboard to ui-grid and vice versa. When trying to get cell values by invoking uiGridCtrl.grid.api.cellNav.getFocusedCell(), I always get null on first click.
I confirmed the issue occur on Firefox, IE, and Chrome.
Is there a work around solution to this problem?
--- console.log output ---
null
copy.js?v=1002:118 d {row: b, col: d}
copy.js?v=1002:118 d {row: b, col: d}
copy.js?v=1002:118 d {row: b, col: d}
copy.js?v=1002:118 d {row: b, col: d}
copy.js?v=1002:118 d {row: b, col: d}
copy.js?v=1002:118 d {row: b, col: d}
--- directive codes ---
app.directive('uiGridCell', ['gridUtil', '$compile','$interval',
function (gridUtil, $compile, $interval) {
return {
replace: true,
priority: -99999, //this needs to run very last
require: '^uiGrid',
scope: false,
compile: function() {
return {
pre: function($scope, $element, $attrs, uiGridCtrl) {
$element.on('mousedown', function(e)
{
e.preventDefault();
console.log(uiGridCtrl.grid.api.cellNav.getFocusedCell());
});
$scope.$on('$destroy', function () {
$element.off();
});
}
};
}
}
}
]);