Add directive to elements produced by ng-grid

核能气质少年 提交于 2019-12-11 16:23:44

问题


Using ng-grid, I developed a simple application to render an excel sheet in UI. I want the fields(table headers) to be draggable, so that I can drop them at run time into some bins, somewhat like - this. The only difference being, here I will be dragging the excel column header.

I can't figure out how to add directive "draggable" to something generated by ng-grid.

P.S. Every column header has to have its own "draggable", so that I may uniquely identify the column number/name

Angular code goes like :

var sth = {"excelData" : [{"Name":"Rohan","Id":"1001.0","Salary":"50000.0","Age":"25.0"},{"Name":"Rohit","Id":"1002.0","Salary":"60000.0","Age":"24.0"},{"Name":"Rahul","Id":"1003.0","Salary":"55000.0","Age":"29.0"},{"Name":"okay bye","Id":"1004.0","Salary":"88214.0","Age":"32.0"}]};
        $scope.myData = sth.excelData;
        $scope.gridOptions = { data: 'myData' };

In my HTML, I use:

<div class="gridStyle" ng-grid="gridOptions">
</div>

Here, Name, Id, Salary, Age, all should be independently and individually draggable.

P.S. Given static json only for understanding. It gets generated at run time and may be very huge.

来源:https://stackoverflow.com/questions/30167130/add-directive-to-elements-produced-by-ng-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!