python - "Load more" pagination button in multiple tables. Django -


I have a form that queries a database and returns the information given in multiple tables. The row number of each column can reach hundreds. Each line is given as a custom model, which I have declared that all the rows for a given table are stored in the object container.

I initially only want to load the first 50 rows in each table. At the bottom of each table, I want to have a "load more" button which loads more than 50 questions on the click (or the result is less than 50)

Django's pagination tutorial It seems that I can only split the pages on different pages. Can I line align with a load more button? Or is it impossible for me to do?

Edit: Here I am currently printing rows for each table, it is a simple to loop

  { Row%} in% R & lt; Tr & gt; & Lt; Td> {{R.name}} & lt; / Td> & Lt; Td> {{R.age}} & lt; / Td> & Lt; Td> {{R.state}} & lt; / Td> & Lt; / TR & gt;   

{% endfor%}

This is my view for 1 table:

  pers = personal Objects (name, age, state) c = RequestContext (request, {"cname": name}) back to HttpResponse (t.render (c)    )  

Sure it is possible. You must make an AJAX call on the server with the necessary information. When you handle this request in Dijongo, you should only reply with table rows, that does not mean the entire HTML page. Then when you receive this response on the customer, add it at the end of the table.

The response should look like this:

  & lt; Tr & gt; & Lt; Td> Col1 line 51 & lt; / Td> & Lt; / Tr & gt; ... & lt; Tr & gt; & Lt; Td> Call 1 line 100 & lt; / Td> & Lt; / Tr & gt;   

Here is an Explosive JS code that can do the trick:

  $. Get ("/ yourapp / data", {page: 2}) .done (function (data) {$ ('. Mytable'). Attachment (data);});   

But instead of just {page: 2} has been provided necessary for information on the Django page, I do not remember what they are. I believe that page needs you, apart from this, you want to give something to indicate that you are only requesting table rows without the rest of the page.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -