Skip to content
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

If item array is empty, newly added item append to 2nd page #96

Open
rassemdev opened this issue May 20, 2018 · 1 comment
Open

If item array is empty, newly added item append to 2nd page #96

rassemdev opened this issue May 20, 2018 · 1 comment

Comments

@rassemdev
Copy link

rassemdev commented May 20, 2018

I have implemented your library, its working good. but the problem is, if i remove all item from the array then add a new one, it append to 2nd page. Instead of first page.

<paginate name="Orders" :list="Orders" class="paginate-list">
	<div class="row" v-for="(row, index) in paginated('Orders')">
		<div class="col-12 col-sm-12 col-md-4 secondColumn pickupSecondColumn">
			<div>
				<p class="name">{{row.title}}</p>
				<p class="name">Color: {{row.color}}</p>
				<p class="name">Cantidad: {{row.quantity}}</p>
			</div>
		</div>
	</div>
</paginate>
<paginate-links for="Orders" :simple="{
        next: 'Next »',
        prev: '« Back'
      }"></paginate-links>

export default {
 data() {
  //all state
 },
methods: {
 afterloading() {
  let singleProductRoute = "routeLInk";
   axios.get(singleProductRoute, {
	params: {
		id: ID
	}
   }).then(function(response) {
	console.log(response.data);
	let singleProductValues = response.data;
	outerThis.Orders.push(response.data);
   });
}
}

here is the array object:
{name: "Comprade Mercado", user: " ", title: " ", color: " ", quantity: " ", …}

@rassemdev rassemdev reopened this May 21, 2018
@brjohnson4
Copy link

See issue #82. Wrapping vue-paginate in a div with v-if="array.length" solved it for me. It's also a great way to display info saying the array is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants