Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 调用ngTable reload时,ngTable中的Select筛选器不更新_Javascript_Angularjs_Ngtable - Fatal编程技术网

Javascript 调用ngTable reload时,ngTable中的Select筛选器不更新

Javascript 调用ngTable reload时,ngTable中的Select筛选器不更新,javascript,angularjs,ngtable,Javascript,Angularjs,Ngtable,我有一种情况,我需要在复选框单击时显示所有数据,这会重新加载ngtable,但选择过滤器不会加载并显示以前的值。是否有其他方法重新加载ngtable筛选器?这是问题的答案 代码 显示所有任务 {{item.name} {{item.type} $scope.filterCTasks=函数(列){ log(JSON.stringify(column)); var def=$q.defer(), arr=[], filterStatus=[]; angular.forEach($scope.tas

我有一种情况,我需要在复选框单击时显示所有数据,这会重新加载ngtable,但选择过滤器不会加载并显示以前的值。是否有其他方法重新加载ngtable筛选器?这是问题的答案

代码


显示所有任务
{{item.name}
{{item.type}
$scope.filterCTasks=函数(列){
log(JSON.stringify(column));
var def=$q.defer(),
arr=[],
filterStatus=[];
angular.forEach($scope.taskDetailData,函数(项){
if(jQuery.inArray(item.ctasquid,arr)=-1){
arr.push(项目CTA滑轨);
过滤器状态推({
“id”:item.cta,
“标题”:item.task
});
}
});
filterStatus.sort(函数(a,b){
如果(a.idb.id)
返回1;
返回0;
});
定义解析(filterStatus);
返回def;
}

您是否尝试过使用ng grid。。它有很多选项@jos:我们正在为我们的web应用程序使用ngtable,大部分代码已经为ngtable编写。如果可能,我建议使用“ngtable”:“~0.8.3”测试您的示例,看看您的问题是否得到解决。有一种模式允许绑定到数组(无需实现
getData
)。检查此项,您是否尝试使用ng grid。。它有很多选项@jos:我们正在为我们的web应用程序使用ngtable,大部分代码已经为ngtable编写。如果可能,我建议使用“ngtable”:“~0.8.3”测试您的示例,看看您的问题是否得到解决。有一种模式允许绑定到数组(无需实现
getData
)。看看这个
<input id="datalabels" ng-model="taskCheckbox.isNormal" ng-change="allTaskCheckboxClicked(taskCheckbox.isNormal)" type="checkbox">
<label for="datalabels" style="font-weight:bold;">Show All Tasks</label>
<table ng-table="taskDetailTableParams" show-filter="true" class="table upgradeTaskDetailTable text-left table-bordered">
    <tbody>
        <tr ng-repeat="item in $data" height="10px" class="animate" ng-animate="{enter: 'animate-enter', leave: 'animate-leave'}">
            <td data-title="" class="text-center col-sm-1 col-md-1 col-lg-1" header-class="text-left" filter="{ 'ctaskId': 'select' }" sortable="'ctaskId'" filter-data="filterCTasks($column)">
                <img ng-src="{{ item.taskImage }}" title="{{ item.task }}" data-toggle="tooltip" data-placement="bottom" />
            </td>
            <td data-title="'Task Name'" class="text-left col-sm-3 col-md-3 col-lg-3" header-class="text-left" filter="{ 'name': 'text' }" sortable="'name'">{{ item.name }}</td>
            <td data-title="'Type of Task'" class="text-center col-sm-2 col-md-2 col-lg-2" header-class="text-left" filter="{ 'type': 'text' }" sortable="'type'">{{item.type}}</td>
            <td data-title="'latest Run'" class="text-center col-sm-2 col-md-2 col-lg-2" header-class="text-left" filter="{ 'selectIdFor0': 'select' }" sortable="'selectIdFor0'" filter-data="filterStatusFor0($column)">
                <img ng-src="{{ item.statusImageFor0 }}" title="{{ item.statusFor0 }}" data-toggle="tooltip" data-placement="bottom" />
            </td>
            <td data-title="'2nd Latest Run'" class="text-center col-sm-2 col-md-2 col-lg-2" header-class="text-left" filter="{ 'selectIdFor1': 'select' }" sortable="'selectIdFor1'" filter-data="filterStatusFor1($column)">
                <img ng-src="{{ item.statusImageFor1 }}" title="{{ item.statusFor1 }}" data-toggle="tooltip" data-placement="bottom" />
            </td>
            <td data-title="'3rd Latest Run'" class="text-center col-sm-2 col-md-2 col-lg-2" header-class="text-left" filter="{ 'selectIdFor2': 'select' }" sortable="'selectIdFor2'" filter-data="filterStatusFor2($column)">
                <img ng-src="{{ item.statusImageFor2 }}" title="{{ item.statusFor2 }}" data-toggle="tooltip" data-placement="bottom" />
            </td>
        </tr>
    </tbody>
</table>

$scope.filterCTasks = function(column) {
    console.log(JSON.stringify(column));
    var def = $q.defer(),
        arr = [],
        filterStatus = [];
    angular.forEach($scope.taskDetailData, function(item) {
        if (jQuery.inArray(item.ctaskId, arr) === -1) {
            arr.push(item.ctaskId);
            filterStatus.push({
                'id': item.ctaskId,
                'title': item.task
            });
        }
    });
    filterStatus.sort(function(a, b) {
        if (a.id < b.id)
            return -1;
        if (a.id > b.id)
            return 1;
        return 0;
    });
    def.resolve(filterStatus);
    return def;
}