1

I am using angular smart table to enable searching and sorting of my table and also pagination.

In addition I am using angular xeditable module to enable editing the rows and to add new rows etc.

On clicking "Add Row", I am able to add a new row to the table. But since pagination is enabled, sometime the user maybe in the 2nd or third page. Now if the user clicks on "Add Row". How do i enable the current page to display page 1, since that is where the newly added editable row is being displayed

Currently if a user is on page2 and he clicks the "Add Row" button, the page is still at 2. I would like the page to move to 1.

Here is the pointer to my code http://plnkr.co/edit/SxcdTGK2vsiDDJyjqanK?p=preview

//html snippet:
    <div ng-controller="EditableRowCtrl">
        <table st-table="display" st-safe-src="users" class="table table-bordered table-hover table-condensed">
...
<tr ng-repeat="user in display">
...
    <tfoot>
        <tr>
        <td colspan="4" class="text-center">
            <div st-pagination="" st-items-by-page="3"></div>
        </td>
        </tr>
        </tfoot>
....

//javascript section:
$scope.addUser = function() {
    $scope.inserted = {
        id: $scope.users.length+1,
        name: '',
        status: null,
        group: null 
    };
    $scope.users.unshift($scope.inserted);
    // Need to display page 1
};

http://plnkr.co/edit/SxcdTGK2vsiDDJyjqanK?p=preview

Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
quietgecko
  • 53
  • 2
  • 7

0 Answers0