我试图从他们的小提琴示例中引用 infragistics ignite ui 网格上的过滤器方法。似乎在他们的小提琴上表现正常,但在我的 angularjs 应用程序上却没有。你可以在这里找到小提琴 - http://jsfiddle.net/40xgtcry/
在我的角度 js 应用程序中,我使用一些虚拟数据在角度指令中初始化网格,然后我通过调用 igGridFiltering 方法来跟进。
define(['directives/directives', 'northwind'],
function(directives) {
directives.directive('gridView', function () {
return {
restrict: 'EA',
scope: true,
link: function (scope) {
scope.$on("InventoryDataReady", function (){
// $( '#' + scope.gridSettings.targetId ).igGrid(scope.gridSettings);
$('#' + scope.gridSettings.targetId).igGrid({
autoGenerateColumns: false,
columns: [
{ headerText: "Employee ID", key: "EmployeeID", dataType: "number" },
{ headerText: "First Name", key: "FirstName", dataType: "string" },
{ headerText: "Last Name", key: "LastName", dataType: "string" },
{ headerText: "Birth Date", key: "BirthDate", dataType: "date" },
{ headerText: "City", key: "City", dataType: "string" },
{ headerText: "Postal Code", key: "PostalCode", dataType: "string" }
],
dataSource: northwind,
responseDataKey: "results",
features: [
{
name: "Responsive",
enableVerticalRendering: false,
columnSettings: [
{
columnKey: "EmployeeID",
classes: "ui-hidden-phone"
},
{
columnKey: "PostalCode",
classes: "ui-hidden-phone"
}
]
},
{
name: "Filtering",
type: "local",
mode: "advanced"
}
]
});
$('#' + scope.gridSettings.targetId).igGridFiltering("filter", ([{fieldName: "FirstName", expr: "Nancy", cond: "equals", logic: "OR"}]));
});
}
};
});
});
网格渲染得很好,但过滤器方法调用会产生以下错误 - '错误:在初始化之前无法调用 igGridFiltering 上的方法;试图调用方法“过滤器”