Pagination with manual entry of page number - javascript

I am trying to search for pagination with manual entry of page number.
I tried to use ngb-pagination and it is working great until I had a requirement for the user that he should be able to enter the page number manually to navigate to the desired page.
I was able to achieve it by JavaScript.https://stackblitz.com/edit/angular-nconlz. But it seems quite odd with adding manual entry.
Use case: User should be able to navigate page by page and also he should be able to manually enter the page number like below;
I would rather not stick to ngb-pagination only, if you anyone could let me know any pagination of above kind is deeply appreciated.
PS: I am avoiding jquery and jquery plugins.
Thanks in advance!

Related

Is it possible to use puppeteer to compare a screenshot with the ui elements of a webpage and find differences?

I am looking for any documentation or help with this. Right now for testing whether UI elements appear on the screen I just check if that class or ID is loaded, for things like the login form, title, logo, submit button, input fields, etc.
I thought I remember seeing Puppeteer could help with analyzing a screenshot and then loading the webpage and comparing the two, but I could be way off.
Also for anyone who use Puppeteer, what's the best way to verify UI elements load on a webpage?
Thanks
You can use Puppeteer to take a screenshot and then use something like,
https://github.com/uber-archive/image-diff or https://www.npmjs.com/package/imagemagick to compare two images.

Programmatically setting the number of displayed rows in a Bootgrid table

Hi I'm writing a web app using rails and as part of it I am displaying data to the user using jQuery Bootgrid. As part of this the user is able to set the number of rows per page of the table. I'd like to be able to have this setting persist between page loads.
When a user chooses an option for the number of rows to display I am able to capture that and store in a model. However Bootgrid doesn't seem to have a simple way of programmatically setting the number of rows. This seems like a common thing to want to do so if anyone has come across this before and can give some help it would be greatly appropriated.
you can find a "setRowCount" implemented in
https://github.com/rstaib/jquery-bootgrid/issues/215 - jquery.bootgrid.modified.txt
Unfortunately the user didn't see fit to properly fork the repo.
Not my best code but it is working:
With jquery fire click event of number of rows that you want...
$("#grid-basic1-header .dropdown:visible [data-action='-1']").click();

Hiding Link In SharePoint Quicklaunch Based On Permissions

I am trying to figure out a way to hide a specific link from the Quicklaunch navigation bar on one of my sites in SharePoint 2013 and am having some trouble. Basically I am trying to make it so that a link is only visible to users within a specific group and any other users that are not part of this group will not see the Quicklaunch link. I have been reading up on how to implement this via css and javascript within the default master page but do not seem to be having any luck. I was using SPServices to get the group membership for the currently logged in user and based on there membership either hiding or showing the specific Quicklaunch item. I implemented this code into the master page and I though I had it working, however upon navigating to a different page, list, or library within the site the given link reappears. I do not know if I am doing something wrong but as a last resort I have come here for answers. If anyone could point me in the right direction I would greatly appreciate it.
Bellow is a screenshot to get a better understanding of what it is I am trying to do...
Security trimming should be automatic for the quick launch. Users not being able to see the list, should not see the quicklaunch entry. One thing i experienced in the past is that the security trimming does not work if your quick launch URL looks like this
https://url/sites/sc/Lists/internallistname
but will work if you include the aspx-page
https://url/sites/sc/Lists/internallistname/AllItems.aspx
Don't know about foundation but it's worth a try...

Allowing user to rearrange entries in Django admin site and how to store that new custom order to survive page refresh?

I have HTML and JavaScript in place that allows a user to move Django database entries (displayed in a table) up and down. However, is there a way that I can store this new order that the user has customized so that it will show up any time the user navigates back to that specific page view? I think get_queryset is what is causing the page (after refreshing) to switch back to the basic filtering. But, I have no good ideas on how to override it or avoid it to accomplish this task. Any help would be much appreciated!
I would suggest using ready solutions: django-admin-sortable or django-admin-sortable2. As for me, I have successfully used second solution and it works. One important note about it is to run ./manage.py reorder my_app.models.MyModel after adding new order field as mentioned here.

How do I handle a large amount of user comments being displayed in a long list down a page using JQuery?

I'm wondering if doing this along in JQuery would be stable enough? or if it would need to be done in ruby/rails first?
Either way I don't want a butt load of messages being loaded when a user enters the page where they're displayed. What I want is limit results to a specific amount then either have the page load more results when a user scrolls down or have them click a "load more" button similar to how it's done on both facebook and googleplus.
Currently I have comments scrolling down my page for miles and would like to use jQuery to take control of this. I'm guessing since each comment is stored in a div / class I could use this as a way of recognising what a comment is.
Anyway trying to figure out the best way to approach this I'd really appreciate some advice and maybe links to some good tutorials on how to pull this off.
I agree with the Ohgodwhy's comment - use will_paginate in Rails.
However, I'd also look at how to do scroll-down pagination, rather than page number links, depending on your design. I like Ryan Bates's screencast on this topic: http://railscasts.com/episodes/174-pagination-with-ajax
He also has a video for doing it without will_paginate: http://railscasts.com/episodes/114-endless-page (the newer, revised version of this requires a subscription).

Categories

Resources