4

当我将 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);
        }
    }
}]);
4

2 回答 2

1

我的错误已解决,经过一段时间的研究,我在这里找到了解决方案Uncaught TypeError: Cannot read property 'msie' of undefined

我的新版本 jquery(1.9.1) 导致了这个问题。

于 2013-08-16T02:37:59.620 回答
0

您需要包含 jQuery UI 才能使用 SlickGrid 的列大小调整/重新排序。

于 2013-08-15T21:16:55.053 回答