Update max_page in jqpagination - jqpagination

I have 1001 entries to be shown .. I have a dropdown box listing how many entries to be shown per page . (10,20,30,40,50). Initially i show 10 entries per page so the number of pages would be 101 .The text content initially shows page 1 of 101. Now when i change the number of entries to be shown per page to 20 , an javascript function is called and the max_page is set to 51 in tht function and text content is showing page 1 of 51 . Upto this its working fine . Now when i click on the last button , it shows the text content as page 101 of 101 ..instead of page 51 of 51 .. further clicks on it are showing wrong values .
$(document).ready(function()
{
$('.pagination').jqPagination({
link_string : '/?page={page_number}',
max_page :total_pages,
paged : paging
});
});
$("#items").change(function(){
$('.pagination').jqPagination({
max_page : total_pages
});
});

You need to update the max page (as follows) instead of re-instantiating the plugin.
$('.pagination').jqPagination('option', 'max_page', 51)

Related

how to click on label with pupeeter?

<label class="_6G4BGa _0Qm8W1 _7Cm1F9 FxZV-M IvnZ13 Pb4Ja8 ibou8b JT3_zV
ZkIJC- Md_Vex JCuRr_ na6fBM _0xLoFW FCIprz pVrzNP KRmOLG NuVH8Q"
for="size-picker-LA815O008-Q110010000" data-testid="pdp-stockAvailable-
label"><span class="hDNRPv r9BRio qXofat ZkIJC- agLu8- JCuRr_"><div
class="_0xLoFW FCIprz"><span class="_0Qm8W1 _7Cm1F9 dgII7d pVrzNP">44</span>
</div></span><div class="nXkCf3"></div></label>
The label I want to click on is on this page: https://www.zalando.fr/lakai-cambridge-unisex-baskets-basses-blackwhite-la815o008-q11.html
i want to select the size 44
i would like to be able to presse on the size 44
all the sizes have the same label but not the same id
ex : for="size-picker-LA815O008-Q110010000"
and i cant put together a code click on this size .

Active Admin pagination

Active Admin's pagination on index pages is great, but we are trying to allow the user to type in the desired page number (in addition to the clickable page buttons).
Their desire is to have a prompt like "Enter Page Number:" and an input box where they can type in the desired page number.
Anyone done this already, or have ideas on how to proceed?
You can create a custom sidebar section like this:
sidebar :jump_to_page do
input :page_number
input type: :submit
end
Then add this to you active_admin.js.coffee file:
$ ->
$("#page_number_submit").on 'click', (e) ->
page_number = $("#page_number").val()
if window.location.search.indexOf("page=") > 0
window.location.search = window.location.search.replace(/page=\d*/, "page=#{page_number}")
else if window.location.search.indexOf("?") == 0
window.location.search = window.location.search + "&page=#{page_number}"
else
window.location.search = "page=#{page_number}"

jqPagination requests for new page

I have a large db table that I want to show to users. I show the info in a table, about 30 rows per page. I want to use jqPagination to allow the users to jump to a different page. So page 1 will show rows 1-30, page 2 will show rows 31-60,... The only example I see are showing how to use it to jump to different section of a page. Is it possible to use jqPagination in a way to request the next 30 rows to a new page?
Thanks in advance!
If you're displaying all table rows to begin with you could use the following code to only show 30 at a time:
$(document).ready(function() {
// select the table rows
$table_rows = $('.table-example tbody tr');
var table_row_limit = 30;
var page_table = function(page) {
// calculate the offset and limit values
var offset = (page - 1) * table_row_limit,
limit = page * table_row_limit;
// hide all table rows
$table_rows.hide();
// show only the n rows
$table_rows.slice(offset, limit).show();
}
$('.pagination').jqPagination({
max_page: $table_rows.length / table_row_limit,
paged: page_table
});
// set the initial table state to page 1
page_table(1);
});
Table pagination example.
If you don't display all rows to begin with, you could adapt this code to fetch the rows from your system using AJAX instead of showing / hiding.

Why CodeIgniter Pagination Link Bloats?

I have spent some time but can't figure out what's wrong. I am using CodeIgniter 2.1.0.
So basically its like this:
My pagination settings:
$config['base_url'] = base_url() . '/stores/';
$config['total_rows'] = $this->stores_model->getTotalRows();
$config['per_page'] = 20; //display 20 rows per page
$config['num_links'] = 10; //display 10 pagination links
$config['uri_segment'] = 2;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
I am getting data chunks like this from controller. Which is also working.
$data['stores'] = $this->stores_model->getChunks($config['per_page'], $this->uri->segment(2));
My view page have:
<?php echo $this->pagination->create_links(); ?>
Now everything is working fine. At first the 10 pagination links are shown but when I click on the link 8, 9 or 10 etc. the pagination links bloats. It shows now links 1 to 20. Why is that? It might be something very simple but can't seem to figure that out. I was expecting the pagination links kind of scroll but shows only 10 links as I have set in config.
Thanks and regards
Deepak
Now I understand
$config['num_links'] got me confused for a while.
This means the number of links to show on both sides (previous and next) of current link.
ie. (show prev 10 links from current) <----- [current page] -----> (show next 10 links from current)
setting it to 5 solved the problem. Now I have about 11 links showing in total all the time as expected.
Thanks again
Deepak

What is straight link to any page of search results in Yahoo?

Essential is that my app parses the results of search from Yahoo!. There was easy to define that to get first page I need to from the next URL
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
but what's straight link to any other page from yahoo! search page ? If to see on link there is
a href="/search;_ylt=A0oG7mulOyVP3FMAnPlXNyoA?p=java&fr=404_web&fr2=sb-bot&xargs=0&pstart=1&b=11&xa=U7cN_L3AOtj18W09Ud7SkA--,1327926565" title="Results 11 - 20" id="yui_3_3_0_1_1327840165621204"
but where is this some param, changing that I can to go to the next page or just to 10 page, for example? Does somebody know about this feature of yahoo?
By the way, YouTube hasn't such problem, his links are very simple, but Yahoo...
UPD Seems to be I defined this params - this is "b=11". Second page has "b=21", the third - "b=31" and so on
Link directly to specific pages by setting the offset (b) correctly.
Yahoo currently shows 10 results on each page, therefore use the following offset:
offset = 10 x pagenumber - 9
Quick example based on the URL you provided:
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
Page 1 (offset = 10 x 1 - 9 = 1)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=1
Page 2 (offset = 10 x 2 - 9 = 11)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=11
Page 3 (offset = 10 x 3 - 9 = 21)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=21
Note:
I don't know the future, but currently the links above work fine.
Yahoo might change the URL structure any time.
What is the role of this parameter "_ylt" ?
I think there is no problem to ignore it.
Yahoo in different country have different content of "_ylt".
And the HTTP has been changed to https://, not http:// .
Taiwan:
https://tw.search.yahoo.com/search?p=soqi+bed&fr=yfp&ei=utf-8&v=0
https://tw.search.yahoo.com/search;_ylt=A8tUwZBhGxlU93YAZHJr1gt.?p=soqi+bed&ei=utf-8&fr=yfp&b=11&pstart=2
US(eng):
https://search.yahoo.com/search;_ylt=AiVNJTPKVpm9Jag8U.STVL6bvZx4?p=soqi+bed&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-329&fp=1
https://search.yahoo.com/search;_ylt=AwrSbDzyGRlUoG0AUn1XNyoA?p=soqi+bed&ei=UTF-8&fr=yfp-t-329&fp=1&b=11&pstart=7
Japan:
http://search.yahoo.co.jp/search;_ylt=A7dPKW9aHBlUDm4A5b2JBtF7?p=soqi+bed&search.x=1&fr=top_ga1_sa&tid=top_ga1_sa&ei=UTF-8&aq=&oq=&afs=
http://search.yahoo.co.jp/search?p=soqi+bed&tid=top_ga1_sa&ei=UTF-8&pstart=1&fr=top_ga1_sa&b=11

Resources