Bootstrap Table how to restore page number and search filter - bootstrap-table

Using Bootstrap Table for CRUD with my .NET Core 6 Razor Page Model, and it is working fine.
When user browsed through a list of items (probably > 100) and trying to edit one of the item, say item #51 which appears in the 5th page.
I will popup another page to let user to edit, and close that page when finishing.
However, my customer doesn't like the popup (not working well in all browser), and requires me to flip to another page instead.
My problem is, when user finished editing the item and return to the page with Bootstrap Table, the listing starts from page 1.
Question: How can I restore the search filter and page number when I return to the same page? Is cookies the only option?

Related

Scrape dynamic rendering data with click button

I have a lot of different scrapers, but all of them are working with server rendering pages or parse responses from API endpoints.
But now I have two very specific web sites to scrape:
First.
Single page, we should click on seach button to get first 10 items. To get next 10 items - click button "Next". After 2-3 sec data in search section is rerendered. On click "Next" I get dummy unparsed data from vaadin service. So data can be parsed only from rendered HTML page.
Second.
Same single page with same principles ( click search button to get init data, click Next button to load new data). But additionally I need click on every items to get all data to scrape ( I scrape some data from rendered search result + from modal window after click on each search result item)
Question - is it possible to scrape such websites with scrapy and splash? I know about selenium, but it's quite heavy and slow, I need other solution. Never worked with splash, but if I am not mistaken it's possisble to imitate click via lua script..
I would suggest avoiding Splash and instead reproducing the underlying requests.
The main issue I see here with going the Splash route is that, if there is no URL that you can use to access a page other than the first page from a web browser, and since Splash does not support (AFAIK) resuming a previous rendering, you would need Splash to have each request to Splash run a Lua script that clicks Next, waits and repeats for N pages.
If reproducing the requests is out of the picture for some reason, using an interactive headless browser (Selenium, Puppeteer) instead of a rendering service (Splash) may be better.

multiple updates in one submit in SPA page

I have a web page written in ASP.net where it finds a list of employees, displays them in a listview and allow the user to change different statuses for each employee.
On each row I have employee information like name, date of birth, address and then 4 status fields that are displayed as checkboxes and a comment field where the user can type a comment explaining why they changed a certain status.
Currently in Listview, there is an edit, delete button when they click edit, the checkboxes and text field are displayed the user updates them and click save.
asp.net will do a postback to save the changes for this row and then fetches the data again to refresh the list.
The problem I am having is the list is very large (more than 3000 names), so I am using pagination to show 50 to 100 names on each page. This is still a big performance problem because after every line update a query needs to run to fetch those names again, and with ASP.NET the server is generating the html and passing everything to the browser.
The customer wants the page to be mobile friendly too, so I am thinking to redo the page using Angular on front end with web-api or mvc.net on back end that returns JSON.
My question is there an easy way to do this and allow the user to change the status for multiple employees on the same page at once and then click one submit to update all the changes? if I do it this way, there will be less queries to run and it will be faster for the user because they don't have to wait after every line update.
Any examples will be greatly appreciated, unless there is a different way to implement this, in this case please let me know.
I have a thought that may work.
On load render names and use pagination.
Then use ajax to send the post to server and change data in database.
When editing has returned successful then only change the values that have been edited using javascript for the user to view.

ASP.NET back and forth between screens

I am working on an application, where a user can start filling a (multipage)form and press back button to navigate to previous screen and continue button to navigate to next screen.
Currently, the page was implemented using the browser's back capability. This causes circular reference
The Scenario is
Navigate from page 2 to page 3 click back button on page 3
User is now in page 2 and clickint back button pn page 2 will take it to page 3 (because of browser's history has page 3.)
This has to be achieved by using session? How can this be implemented correctly? What options does asp.net provide?
Have a look at the Wizard control - it's designed for your sort of scenario where you have multiple pages and you want to go back and forth between them. And you can combine it with AJAX to avoid postbacks :-) ScottGu has a piece on it here.
You can save all steps in session variable, for example of type Queue. When you need return two steps back, simple, two times dequeue and go to uri.

Context Menu in Jqgrid on Row Click in Jqgrid

I am using Jqgrid 3.6 beta version with asp.net and i wanna add dynamic context menu on row selection.When ever user rightclick a row in jqgrid he wants to see some menu like file,edit and other menus. I have completed using single page i.e. both the jqgrid and its parent(JS files) are in single page . But in my main Application I have one master page in which ill define all the JS and seperate page for the content(Jqgrid). So what happens is the same code which is running in single page application is not working in the master detail page.Can any one help me out in this
Atlast i got the solution for the context menu and its working fine. for this to work i needed to add afterinsertrow as well as ondblclickrow function and then it works fine

Best way to do paging in a .NET page

Hope you are having a great day.
I have a page where I let users browse related items (photo albums) posted by other users.
I show the album thumbnail, title, author, ratings views and category for each albums.
Now the number of related items can get large say 500 photo albums is related to a album user is viewing. I just show first 20 and drop a link saying 'View All'
Once the user clicks View All I take him to a page where I display 50 items per page.
Option 1: using a repeater\grid control
When user clicks a page I get the right items (using sql) and bind the result to the grid
The page is refreshed and user sees new page. So one big request and user sees all thumbs.
Option 2:
when user clicks the pager I use Ajax to get the thumbnail file name, title, rating, author etc.
Then I build the grid manually and set the src attribute of element using javascript
Then I append the resulting grid to a div. User sees the new grid without page refresh.
My concerns:
I have the thumbnails and all image files in file system (not database)
In second approach javascript will send 50 separate request to web server to get the image files. This will cause a lot of requests on the web server. Large concurrent users will flood the server with image file requests.
What is the best & efficient way to do paging and storing user files?
Is my app going to die by putting the images in file system since the app should handle millions of photos?
If you aren't already using one, a CDN (content delivery network, like Amazon S3 etc) will help (so you can download from multiple places concurrently).
Also, instead of requesting one image, request a page from the server. Let the server decide how many images to return.
You could try some css sprite techniques.
Definetely you shouldn't use Option 1 since it would take a lot of time for the page to load
Aldso the second alternative id not so good either.
You can use your GridView/ListView control but use server side paging to get the data. This way you could load only the information that is needed per page.
You can see how to implement a stored procedure for server side paging here : http://www.sqlteam.com/article/server-side-paging-using-sql-server-2005
Then you can bind the individual page the PageIndexChanging event handler of your Gridview
so only the page that is needed is actually loaded.

Resources