Jump to content

pagination - big database


klepec

Recommended Posts

Is it smart to use ajax pagination for bulk databases?

 

I have that cool fast jquery live search filter, but i am afraid i wont be able to use it with PHP pagination since (as far as i know) page content is generated (selected from database) every time you go to next page.

 

Any suggestions?

Link to comment
Share on other sites

A good AJAX script will make a new call to a PHP Script connecting to a DB to get the next page data.

 

If its a LARGE database table (with like 10,000 records) and you pull all of them at once and load into AJAX, you will slow down your website load

Link to comment
Share on other sites

A good AJAX script will make a new call to a PHP Script connecting to a DB to get the next page data.

 

If its a LARGE database table (with like 10,000 records) and you pull all of them at once and load into AJAX, you will slow down your website load

 

@onlyican, I think you are implying that the question was about pulling ALL the data down to the client and then using JavaScript to do the pagination. There would be no reason to use AJAX for that since the data could be loaded on first page load. But, yes, if the OP is talking about using pure JavaScript to do the pagination, I agree with you that it would be a foolhardy solution.

 

@op, I assume you were talking abut using AJAX to fetch one page of data at a time as the user selected an option to change the page. There is no intrinsic benefit to doing that. In fact, AJAX just adds another layer of complexity. That's not to say it doesn't have value but, IMO, it is best to first get a process working without AJAX. Once you have it working, then you can add AJAX or other bells and whistles as needed.

 

And, off the top of my head here are some things you may or may want to consider by using AJAX.

 

Cross-browser issues. There are some good JS frameworks that would decrease these problems, but with mobile devices and new browsers it will likely never go away. So, with AJAX you run the risk of some users having problems.

 

As stated above, more complexity. As with a machine, the more moving parts you have the harder it is to maintain and the more likely something will break.

 

A reason TO use AJAX is seamless page transitions. The user doesn't have to refresh the entire web page to see the next 'page' of data. If your process of getting the data takes several seconds this could be useful because no one wants to be looking at a white browser window waiting for a page to load. But, if it's taking a bit to load the page, that's usually a sign that the code is inefficient.

Link to comment
Share on other sites

Yes, I was talking about already generated content ( generating long <li> list of database records - using php and mysql ) which is later sliced to pages using AJAX. The only reason for that ( not using PHP ) is having a whole list of content, so my ajax instant filter could search through all the possible options.

 

I now decided to use different method, which is filter searching through database itself. Someting like ajax autocomplete thingy but outside the input field.

Link to comment
Share on other sites

Yes, I was talking about already generated content ( generating long <li> list of database records - using php and mysql ) which is later sliced to pages using AJAX. The only reason for that ( not using PHP ) is having a whole list of content, so my ajax instant filter could search through all the possible options.

 

I now decided to use different method, which is filter searching through database itself. Someting like ajax autocomplete thingy but outside the input field.

 

An auto-complete feature is a nice feature, but is that really what you "need". You need to crawl before you can walk and walk before you run. You're trying to jump to the 100 meter sprint in the Olympics.

 

I would start with a simple paginated grid with the ability to submit search criteria. THEN add additional features to make the data more user friendly. A dynamic lookup can be very problematic if not done correctly.

Link to comment
Share on other sites

Aha okay i understand,

What about just PHP submit where you check database for any rows containing "the input" (mysql "LIKE").

Yes

 

And a bit of ajax, just for the live refresh. :D

No.

 

That's not to say you DON'T use AJAX, just start with making it work, THEN add the AJAX if you feel it is worthwhile. Adding AJAX into a process you've never done will only increase the complexity.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.