Blog - Ajax loaded row details - question

Blog - Ajax loaded row details - question

crush123crush123 Posts: 417Questions: 126Answers: 18
edited April 2017 in Editor

The latest blog entry stimulated my interest, I currently have a page with 2 datatables, one for orders, a second for order details, which works fine, but I thought using the loaded row as featured in the blog would be a really nice feature.

I have the page working to an extent, and when i expand the row, I am viewing the data object in the console as expected, but the ...loading stays on the page

i have set up a test page as an example http://test2.forthwebsolutions.com/hutch4dmin/orders.php

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,683Questions: 1Answers: 10,100 Site admin
    Answer ✓

    Hi,

    You have div.html( json.html ) in your code, just like in the blog post, but there is no html property in the JSON returned from the server. That means that div.html( undefined ) is called, thereby not setting the HTML.

    Your JSON is returning an object with data, options and files properties (presumably an Editor script?). You'd need to either have the Javascript build some HTML based on that, or have the server return the HTML you want to use.

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited April 2017

    Of course, i'm too busy copying and not thinking

    i will take the json object and use $.each to loop through the data and build a table or something like that.

    This would work great, but for an even better result, do you have any advice on how to incorporate a datatable into the div ?

This discussion has been closed.