The browser crashes
The browser crashes
andi77
Posts: 11Questions: 1Answers: 0
Hey there,
this worked quite nicely for me until I started to feed the JSON file with around 7 million line codes, all valid entries. At 3 million lines it worked great, once I doubled that I get the browser message AW Snap and it breaks: https://i.imgur.com/4tKy0r8.png
Any trick to using a large amount of data with this table? I am talking about storing 300-400 million entries
This question has an accepted answers - jump to answer
Answers
Use Server side processing mode with large datasets. Your server will then perform all the paging work and return only the rows to display on the page. You will need to use or create a server side script that supports the protocol in the link.
Kevin
Loading it from MySQL database worked great Kevin. Although it's a small difference. When feeding it from JSON, once I would hit SPACE I was able to combine columns and filter results. Now, with this new workflow, once I hit space it returns no results: https://i.imgur.com/7ImWd63.png
Any chance I could use a trim function to ignore SPACE and combine as the previous JSON feed did? or any other trick and where to add it? Thanks so much!
How were you doing this before?
Did you enable server side processing or just using ajax?
Its difficult to debug screenshots. Can you post a link to your page or a test case replicating the issue so we can see what you have?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Ah, sure. Here is the new server side processing workflow: www.shorturl.at/bejXZ
Just try to combine 2 words like: vet mar -> https://i.imgur.com/9O7ewHI.png
There is: veterinar manastur
And: veterinar marasti
Translation: veterinar=veterinarian
manastur, marasti - 2 areas from a city
You could notice that once you hit space after typing vet there are no results, whereas before I was using your dummy data from any AJAX example you have and I was able to combine them fine: https://i.imgur.com/vtGFtIM.png
Sorry but your shortened link doesn't seem to work. It just pulls up the https://www.shorturl.at/ site.
Kevin
Actually, I noticed that it happens on your demos too, it's the same thing, here's a short 30 second recording with that: https://www.loom.com/share/0ca40f018fb94ffb9a83ab494f1e8990
I really hope it's clear now.
Client side searching uses the "Smart Search mode explained in the
search()
docs. If you want the same behavior then you will need to build it into your server script DB queries. You may or may not want to do this for performance reasons.Kevin
Thanks, Kevin, I'll dig into that. I also found some source code on the web that you need to pay, although I can see your software is open source: https://www.codexworld.com/downloads/datatables-server-side-processing-with-php-mysql
"Pay us to use this script for commercial purposes". Is that OK what they're doing? Just wanted to let you know
It's all open source, so there's no need to pay, that's just somebody trying to make a fast buck. These two threads should help, here and here, as they're discussing smart search with server-side processing.
Colin
Thanks, Colin. I tried everything from those threads, to no avail. I am not that expert and to be honest the explanations from there are quite bad, made for experts instead of step by step.
What server-side processing script are you using?
For our PHP Editor libraries, it did write a "smart" search which mimics how DataTables does it. It is available in the script but commented out by default.
Allan
That's also confusing because the file you're pointing me to is called Editor.php while I understand that I need to edit ssp.class.php.
Right, we've written two different PHP implementations for server-side processing:
So you could absolutely modify the SSP class to do the search you want - you can base it off the code that I pointed to in the Editor PHP file, which might be the best option if you are happy reading and writing that code and you just want a simple script.
Allan
Hmm still not sure what I am doing wrong, can you let me know where that might be? So this is my ssp file: https://pastebin.com/raw/g9ju2dJe
Can you let me know exactly where to add https://pastebin.com/raw/TmBRAjAS in order to have it working?
Or do I need to delete some code from the ssp file and replace it with that commented one from the editor?
Put it in the
filter
method from that class.I suppose the first question really is do you understand what the
filter
method is doing? Specifically the code in the firstif
block? Understanding that is key to doing what you are looking for.If you compare the two pieces of code you'll note that the bit you lifted from the Editor PHP file splits the incoming search string into words and adds a loop for that. The SSP code does not do that.
That is what you want it to do. Split the incoming search into words and then loop over them adding the conditions as needed.
It isn't just a case of dropping that Editor code in - that won't work. You need to understand what the code is actually doing.
Allan
"You need to understand what the code is actually doing"
I don't and I think that literally every guy that answered this thread could have done it in 10 mins tops and provided me with the actual code, but for some reason, they chose not to.
That's totally fine, you have your own way of providing support. Which is quite bad to be honest, but that's your choice. I quit using your product. best of luck!
Sure we could have done it, but we aren't here to write your code for you (that's what paid contractors are for). We are trying to provide support by helping you to understand what is required, what the code is doing and how it can be modified, so in future you can support yourself.
Personally I'm really proud of the community here and the support provided over the last decade and some.
Allan
Well, if you're proud, it means you have no idea what support means, and I do not write that to offend you. This thread could have had 5 entries only and a happy guy that could have been your paid customer from now on. Instead, it was prolonged for days with no closure and someone moving away from your product.
If that's a healthy approach in your view, then you'll lose on the long run.
Good post, Allan.
@andi77, your notion of support seems to mean that someone else writes your code for you at no cost to yourself. That way you are not inconvenienced by having to think and learn. You're not the only person with that approach, but it's not suited to a forum like this.
@tangerine I only needed this to work one time, because I am not a tech guy and I won't be spending my time in this world. I was just testing. So if you think that I'll stay at least 1 year to learn PHP for a code that someone could literally gave in 10 mins for testing purposes, then you're simply out of this world.
It's like going to the doctor and he'd gave you instructions instead of actually performing the surgery. Would you spend 6 years to learn medicine to perform that surgery when he can do it in minutes?
Think again.
There is a problem with your expectation. Allan and everyone else answering questions on this forum are busy with their own projects and don't have the time to dig in and fully understand the solutions for everyone posting questions. No two projects are the same. Sometimes the questions are less complex and in 10 minutes we can provide a running example. You can look on the forum and see many examples of this. Other times, like your case with server code being involved, it takes more understanding of the overall solution to help.
If you are not a tech guy then how would you know it would take 10 minutes? As Allan said moving the code from the Editor to the ssp class would take some changes. It would take more than 10 minutes of someone's time to workout those changes to provide a working solution that works in your environment.
No but I definitely would be paying for the surgery if I couldn't do it myself
Kevin