Show data with render function
Show data with render function
Hello, i have this but not found


What do I have to put in the render to show me all the dates or the channel? How would the code be written?
This discussion has been closed.
Hello, i have this but not found


What do I have to put in the render to show me all the dates or the channel? How would the code be written?
Replies
You don't need the
columns.renderoption to display the data unless you want to manipulate it in some way. You just needcolumns.data, for example:In your ajax.done() function use
rows.add()to add the rows, for example:Kevin
http://live.datatables.net/lejosopu/1/edit
Where would this line of code go?
$('#total').DataTable().rows.add( response ).draw();
In your ajax done() function where you have the
console.log(response).It would be easier if you copied the code text into your posts and use [Markdown formatting] using triple back ticks (```) on new lines before and after the code block. This way we can update your code in our responses.
Kevin
http://live.datatables.net/huluwove/1/edit
Dont work. Shows nothing
Do you mean the Datatable doesn't show or the data doesn't show?
Can you post a link to your page so we can help debug?
Do you get alert massages?
Do you get errors in your browser's console?
Use the browser's network inspector to view the XHR response.
I meant for you to copy the code into your post. Also make sure the backticks are on separate lines.
Are you calling the getlogs() function?
Kevin
Ok
Do you get any errors?
What does the console.log(response) show?
Are you calling the getlogs() function after intiializing Datatables? Maybe put the call in the
initCompleteoption.As I told you before if you want anything deleted please PM @allan or @colin. Better yet don't post anything you don't want people to see.
Kevin
Ok
Your response data is contained in the
dataobject so you need to addresponse.data, for example:Updated example:
http://live.datatables.net/huyucepe/1/edit
Kevin
you are a genius, I really appreciate the help
Glad to help!
Kevin
One more question, can I access the time or phase of the json_log attribute?

Yes you can. Start by looking at this Nested Objects example. However I don't think it will be that easy in your case. The reason is that it looks like
json_logis a JSON string not a Javascript object. There are lots of ways you can deal with this but what you choose is based on your environment and requirements. Some options are:json_logto JSONresponse.dataarray elements and useJSON.parse()on thejson_logto turn it into an object beforerows.add().Kevin
$("#total").DataTable().rows.add(response.data.JSON.parse(json_log)).draw();something like that?
I replied to your message asking why you want the threads deleted. People have taken time to answer your queries, and those responses could help other users. I'm happy to delete threads if there's personal data, but these threads have none. May I ask the reason for the deletion request?
Colin
Personal reasons, if you can't, it doesn't matter. I would appreciate if you could