当我将Slick Grid插件包装到指令中时,一些Slick Grid选项(调整大小和拖放列)不起作用。我认为这些事件可能与指令相冲突。 有没有人有任何见解?
我的HTML:
<div style="width:600px;height:500px;" s-grid></div>
我的指示:
angular.module('slickGrid.directive', [])
.directive('sGrid', [function () {
return {
restrict: 'EA',
link : function(scope, element, attrs){
// for clearer present I initialize data right in directive
// start init data
var columns = [
{id: "title", name: "Title", field: "title"},
{id: "duration", name: "Duration", field: "duration"},
{id: "%", name: "% Complete", field: "percentComplete"},
{id: "start", name: "Start", field: "start"},
{id: "finish", name: "Finish", field: "finish"},
{id: "effort-driven", name: "Effort Driven", field: "effortDriven"}
];
var options = {
enableCellNavigation: true,
enableColumnReorder: true
};
var data = [];
for (var i = 0; i < 50000; i++) {
var d = (data[i] = {});
d["id"] = "id_" + i;
d["num"] = i;
d["title"] = "Task " + i;
d["duration"] = "5 days";
d["percentComplete"] = Math.round(Math.random() * 100);
d["start"] = "01/01/2009";
d["finish"] = "01/05/2009";
d["effortDriven"] = (i % 5 == 0);
}
// end init data
// finally render layout
scope.grid = new Slick.Grid(element, data, columns, options);
}
}
}]);
答案 0 :(得分:1)
我的错误得到解决,经过一段时间的研究,我在这里找到了解决方案Uncaught TypeError: Cannot read property 'msie' of undefined
我的新版本jquery(1.9.1)导致了这个问题。
答案 1 :(得分:0)
您需要包含jQuery UI才能使用SlickGrid的列调整大小/重新排序。