New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting row from ngTable when it's the last item on page #720
Comments
+1. I've got the same issue as above. |
As a workaround, you can check If the current row is the last one on that page and it's not the first page if ($scope.tableParams.data.length == 1 && vm.tableParams.page() != 1) { |
That's what I've done in the past.
I don't think ngTable is going to be monitoring the dataset any time soon
(this would introduce potential performance problems). So I would suggest
going with this as a solution.
…On Tue, Feb 7, 2017 at 9:46 AM, M.Msallati ***@***.***> wrote:
As a workaround, you can ckeck If the current row is the last one on that
page and it's not the first page
if ($scope.tableParams.data.length == 1 && vm.tableParams.page() != 1) {
$scope..tableParams.page(vm.tableParams.page() - 1); }
$scope..tableParams.reload();
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#720 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA2HPnt6g1_cHsg4NhwX9VKNbwHuzASsks5raD2HgaJpZM4GLPEq>
.
|
I've also used @msallati workaround in the past. Works pretty good but it would be nice to add this fix to the ngTable as it is a little bit annoying... It's only one check during deleting operation so I think it won't be a performance hit for overall library. |
The problem is that ngTable doesn't "know" about the delete operation.
ngTable would need to watch the dataset for changes - this would be a
performance problem
…On Tue, Feb 7, 2017 at 10:04 AM, Jakub Powierza ***@***.***> wrote:
I've also used @msallati <https://github.com/msallati> workaround in the
past. Works pretty good but it would be nice to add this fix to the ngTable
as it is a little bit annoying... It's only one check during deleting
operation so I think it won't be a performance hit for overall library.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#720 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA2HPo3igPmhmaPxxusbi-rJ1YreOLGqks5raEGigaJpZM4GLPEq>
.
|
Thanks for your explanation! Now I can fully understand what's going on :) |
When the last item is removed from a table on page 2 or greater, the paginate navigation disappears.
I got around it with the above check to see if the filtered data comes back empty and if we're not on page one. Is there a built in way to manage this that I am overlooking?
The text was updated successfully, but these errors were encountered: