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