alfajango / jquery-dynatable

A more-fun, semantic, alternative to datatables
http://www.dynatable.com
Other
2.77k stars 361 forks source link

Dynamically add links to dynatable #122

Closed akzogibbs closed 10 years ago

akzogibbs commented 10 years ago

I don't have links in my json but i would like each row in my table to have a href added to it.

Can anyone point me to an example of how this can be implimented please?

Thanks.

reddybabu1 commented 10 years ago

You have to re-recreate JSON object using each iteration.I think it is not a part of DYNATABLE.

Use this code $(jsonobject).each(function() {
var your_row_content =""+this.your_json_content+";
this.your_json_content = your_row_content;
});
Now jsonobject will avilabele with Href

Mewit commented 10 years ago

Maybe I'm misunderstanding the issue, and maybe my solution isn't the best option, but I put links in a dynatable just by making the JSON entry the link. For example:

{'exampleLink' : '<a href = http://www.example.com>Example Text</a>'}

akzogibbs commented 10 years ago

Thanks! Mewit & reddybabu1 i managed to put a link directly onto some text using Mewit's method. It's not ideal but it's a good start. If i could find a way of adding a button to each Row then i could add a link in the same way hopefully.

Reddybabu1 can you point me to an example of what you've described please? I get that you've targeted each object which is a row, but then how would i apply a link to each ojbect? Would i still need to pass a href in the json file?

akzogibbs commented 10 years ago

I managed to figure out what i was trying to do which was...

To capture the id of the link and then use that data to provide other json data associated with that links location. It's always seems really easy once you've figured it out.

http://jsfiddle.net/AkzoGibbs/W8gyE/

drouillard commented 10 years ago

Closing as it appears solution found