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

gofortheeyezboogofortheeyezboo Posts: 17Questions: 2Answers: 0

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

  • kthorngrenkthorngren Posts: 20,313Questions: 26Answers: 4,771

    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

  • gofortheeyezboogofortheeyezboo Posts: 17Questions: 2Answers: 0

    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

  • kthorngrenkthorngren Posts: 20,313Questions: 26Answers: 4,771
    edited July 2022

    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:

    1. Populate the HTML table first then when complete initialize Datatables
    2. Use ajax or data to have Datatables build the table
    3. Keep the same process you are using and use rows().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

  • gofortheeyezboogofortheeyezboo Posts: 17Questions: 2Answers: 0

    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.

    </td>
                <td style="text-align:left;white-space:nowrap">example data</td>
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>         
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>         
                <td style="text-align:right"></td>
                <td style="text-align:right"></td>
                <td style="text-align:right"></td>          
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:left;white-space:nowrap"></td>
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:right"></td>
                <td style="text-align:right" class="auto-style1"></td>
                <td style="text-align:right"></td>          
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:left;white-space:nowrap"></td>
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>         
                <td style="text-align:center"></td>
                <td style="text-align:center"></td>
                <td style="text-align:right"></td>
                <td style="text-align:right"></td>
                <td style="text-align:right"></td>          
                <td style="text-align:center"></td>
                <td style="text-align:right"></td>
                <td style="text-align:right"></td>
        </tr>
    

    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

  • kthorngrenkthorngren Posts: 20,313Questions: 26Answers: 4,771
    Answer ✓

    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

  • gofortheeyezboogofortheeyezboo Posts: 17Questions: 2Answers: 0

    ok I will give that a shot, thanks for your time!

Sign In or Register to comment.