Server-side hidden rows example, having problems attaching event to the image
Server-side hidden rows example, having problems attaching event to the image
bickle
Posts: 8Questions: 0Answers: 0
I'm following along with the server-side hidden rows example (http://82.113.152.82/release-datatables/examples/server_side/row_details.html), and I can't seem to get the events to attach to the image so that the grid can expand or contract.
I mocked up a sample here: http://live.datatables.net/gopatiz/2/edit?html,css,js,output , although since the example required an additional field in the the json results, I linked it to a separate datasource and that doesn't load (locally it loads fine). But at least with the source listed, you can see what the json output looks like. Also, just to see if the even was firing at all, I threw in an alert, and that isn't appearing when I click on the image.
I tried a few different things, and found that I can listen for an event on the tbody click, but not on tr/td/img. I'm not sure what that means, but thought it might be helpful.
Any suggestions on what I need to look at in order to fix this? Thanks,
I mocked up a sample here: http://live.datatables.net/gopatiz/2/edit?html,css,js,output , although since the example required an additional field in the the json results, I linked it to a separate datasource and that doesn't load (locally it loads fine). But at least with the source listed, you can see what the json output looks like. Also, just to see if the even was firing at all, I threw in an alert, and that isn't appearing when I click on the image.
I tried a few different things, and found that I can listen for an event on the tbody click, but not on tr/td/img. I'm not sure what that means, but thought it might be helpful.
Any suggestions on what I need to look at in order to fix this? Thanks,
This discussion has been closed.
Replies
You are using a static event and applying it to the document before any data has loaded (Therefore there is nothing to attach the event to). You want to use a jQuery delegated event. See the top FAQ: http://datatables.net/faqs#events .
See also the updated 1.10 example: http://next.datatables.net/examples/server_side/row_details.html
Allan