Having an issue with my data just being dumped onto a blank white page
Having an issue with my data just being dumped onto a blank white page
I have a .asp file where I am using vbscript to query a sql db and dumping the results of that into a datatable. When I launch the page it immediately pops up a white page with my query results on the page no table or styling of any kind. When I view page source it's like my original asp.net file is being cut off but it's cutting off the beginning where all of the jquery etc is linked so i have nothing but a body tag with a bunch of data in it. I am using VS2017 and IIS express. Upon further inspection it looks like where the source document starts is about 2100 records in to the 3200 total. Anyone have any idea what could cause just the latter half of my asp doc to be sent to the browser? I have been searching up and down and haven't found anyone with a similar issue to mine. My understanding is that when the datatables get too big it just slows down so I am assuming it's something to do with my setup but I cannot find what would cause this. I have used the same methods on other tables and they worked fine but they used querys with much fewer results. Any insight would be appreciated!
This question has an accepted answers - jump to answer
Answers
How are you populating Datatables with the DB data? Are yo using ajax or populating the HTML table first then initializing Datatables. Please provide more details of how this is setup. Better would be a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
I am initializing datatables in a script tag in the header then I have my table setup in HTML and have a vbscript that injects the data from my query into the tables using a loop. it's a do until loop so it goes until it finds the end of file from the db query. The db I am connecting to contains sensitive data so I don't want to put any of the info out there. I posted this question kind of as a shot in the dark hoping someone had seen it before and could answer without analyzing the code. I don't want anyone to waste time on this as I have already done enough of that for all of us xD
Sounds like you are initializing Datatables first then directly adding the table data to the HTML. Datatables won't know about the table data. You have some options:
ajax
ordata
to have Datatables build the tablerows().invalidate()
after the HTML table has been populated to have Datatables refresh its data cache with the new table.See this FAQ for more details.
Kevin
the issue that I am having is that when I open the site in a browser and view source, all it's showing is like 20 some thousand lines of html like this which is populated with the data from my query. I removed it from the example below because it contains sensitive data but the tds are being populated correctly.
it completely cuts off all of my code that declares the tables, etc so what I am left with is just my data from the query on a blank white page. So it is running my query and script that populates the table fields. The first record that it shows is also like 2000 something in to the 3200 total and its not a complete record it's just being cut off arbitrarily (in this case you can see the closing td tag where it cut off). I am wondering if the volume of data is just too high for what I am working with
Take a look at this doc describing the Datatables processing modes and data sources. It sounds like you will want to move away from the loading process you have of using a loop to build the HTML rows to instead use ajax to load the table and let Datatables build the table. With 3200 rows you might not need to implement server side processing. Start with client side processing to see if the performance is acceptable.
Take a look at this ajax example. View the source and you won't see all the rows. Datatables will build a data cache to store all the row data then place only the rows being shown in the DOM.
The next step is server side processing which is a client/server model where the server script controls the paging and sends only the data for the row. You will need a server script to support the SSP protocol. See these examples.
Kevin
ok I will give that a shot, thanks for your time!