Skip to content

using splice() instead of push to add new items in table  #749

Description

@Xsmael

Hello I am trying to use splice() instead of push to add new items in table. This is to support pagination with multiple pages, because when I have several pages and I add one item it goes to the end of the last page regardless of what the current page is.
That was very annoying so with splice i can insert it a the end of the current page, the only problem is that the editable row form doesn't automatically appear, I have to click edit button every time I add a new row.
Here is my addEmptyRow() function.

    $scope.addEmptyRow = function () {
                $scope.inserted = {
                    ID_utilisateur: $rootScope.currentUser.ID
                };
                // $scope.chauffeurs.push($scope.inserted);
                let index= ($scope.currentPage * $scope.listSize) -1;
                $scope.chauffeurs.splice(index, 0, $scope.inserted);
            };
            

How can I solve this ?
Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions