My example is not working as it does on the example page, am I missing something?

My example is not working as it does on the example page, am I missing something?

Lonnie.HullLonnie.Hull Posts: 32Questions: 11Answers: 0

I'm looking to combine column filtering and the totaling API. I've started by copying over the API example, but it's not working in my test environment. Can anyone see what I'm missing?

http://live.datatables.net/wipidaha/1/edit

This is what I'm trying to copy.

https://datatables.net/examples/plug-ins/api.html

Thanks

Replies

  • Bindrid2Bindrid2 Posts: 79Questions: 4Answers: 12
    edited August 2018

    both example and your code are missing div id="demo" tag that exists right before the table tag.

    I added it here http://live.datatables.net/wipidaha/2/edit

  • Lonnie.HullLonnie.Hull Posts: 32Questions: 11Answers: 0

    Bindrid2,

    thank you, I saw the demo tag but understand exactly where it should have been declared.

    The button isn't working in the test environment. Do you think there's missing code in addition to what you found?

    Thanks

  • Bindrid2Bindrid2 Posts: 79Questions: 4Answers: 12

    @Lonnie.Hull Not sure what you think is not working, its working for me.

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    The test environment is "sandboxed" and won't show alert messages. If you click on the upward facing arrow in the upper right of the output tab the web page will display fully in the browser and the alerts will show.

    Kevin

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    Or better yet just go here:
    http://live.datatables.net/meyaroqi/1

    Kevin

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    The HTML for the demo is not showing the "demo" div prior to the table.

    <div id="demo"></div>
    

    Hence Lonnie's code is missing it, hence the js "prepend" doesn't work.

  • Lonnie.HullLonnie.Hull Posts: 32Questions: 11Answers: 0

    Thanks guys. I did not see the live preview option. It is working as expected. Now to try and add in the filtering option.

This discussion has been closed.