ngHandsontable icon indicating copy to clipboard operation
ngHandsontable copied to clipboard

Improvement: Add hotid on instance

Open Rex90 opened this issue 7 years ago • 1 comments

Right now when you pass hot-id attribute it doesnt get attached to the core instance of the table. This is really useful to have when there are multiple tables on a sheet. I cant check in code but on my local version of ngHandsontable adding this worked:


        if (htSettings.hotId) {
          hot.hotId = htSettings.hotId; // add this line 143
          hotRegisterer.registerInstance(htSettings.hotId, hot);
        }

Rex90 avatar Sep 13 '16 07:09 Rex90

In the mean time i created this custom directive

app.directive('hotIdAppend',["hotRegisterer",function(hotRegisterer) {
    return {
        restrict: 'A',
        link: function (scope, element, attr){
            var hotInstance = hotRegisterer.getInstance(attr.hotId);
            hotInstance.hotId = attr.hotId;
        }
    };
}]);

Rex90 avatar Sep 13 '16 07:09 Rex90