0

I am using smart-table plugin for AngularJS to display a collection information. I have integrated the same with my backend API using the stPipe function which is triggered whenever a search or sort operation is performed. However, I want to place some buttons above the table which act as a filter. When I click on either of these buttons, I want to trigger the stPipe function of smart table and hit the backend API to fetch the filtered results. How can I accomplish this ?

1 Answer 1

2

The solution is to put the table state in a controller variable.

Everytime the callServer function is called, it will update this variable. This way, you will be able to refresh the table.

In this code, the callServer would be your stPipe function and your external button would call the refreshGrid() function.

this.tableState = null;

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

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

I needed this before and I have posted the solution in this question: Smart table - angularJs - ajax refresh table

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.