Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.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
AngularJS智能表格:如何使用按钮为数据设置预定义的过滤器?_Angularjs_Smart Table - Fatal编程技术网

AngularJS智能表格:如何使用按钮为数据设置预定义的过滤器?

AngularJS智能表格:如何使用按钮为数据设置预定义的过滤器?,angularjs,smart-table,Angularjs,Smart Table,我正在使用AngularJS的智能表插件来显示集合信息。我使用stPipe功能将其与后端API集成,每当执行search或sort操作时,就会触发该功能。但是,我想在表上方放置一些按钮,它们充当过滤器。当我点击其中一个按钮时,我想触发智能表的stPipe函数,点击后端API获取过滤结果。如何实现这一点?解决方案是将表状态放入控制器变量中 每次调用callServer函数时,它都会更新此变量。这样,您将能够刷新表 在这段代码中,callServer将是stPipe函数,外部按钮将调用refresh

我正在使用AngularJS的
智能表
插件来显示集合信息。我使用
stPipe
功能将其与后端API集成,每当执行
search
sort
操作时,就会触发该功能。但是,我想在表上方放置一些按钮,它们充当过滤器。当我点击其中一个按钮时,我想触发智能表的
stPipe
函数,点击后端API获取过滤结果。如何实现这一点?

解决方案是将表状态放入控制器变量中

每次调用callServer函数时,它都会更新此变量。这样,您将能够刷新表

在这段代码中,callServer将是stPipe函数,外部按钮将调用refreshGrid()函数

this.tableState = null;

this.callServer = function callServer(tableState) {
    ctrl.tableState = tableState;
    ...
}

this.refreshGrid = function(){
    ctrl.callServer(ctrl.tableState);
}

我以前需要这个,我已经在这个问题中发布了解决方案:

解决方案是将表状态放在控制器变量中

每次调用callServer函数时,它都会更新此变量。这样,您将能够刷新表

在这段代码中,callServer将是stPipe函数,外部按钮将调用refreshGrid()函数

this.tableState = null;

this.callServer = function callServer(tableState) {
    ctrl.tableState = tableState;
    ...
}

this.refreshGrid = function(){
    ctrl.callServer(ctrl.tableState);
}
我以前需要这个,我已经在这个问题上发布了解决方案: