Closed T-E-D closed 6 years ago
Hi @T-E-D , I think you are referring to the documentation of the previous version of the library (jQuery-KingTable); the new library is different in many ways.
The new way to define custom HTML for a column is to use an html
property, defined as a function that receives an item of the table in input and must return an HTML fragment.
html: function (item) {
return `<a href="/some/url/${item._id}">Go to details</a>`;
},
The piece of source code that is handling this parameter, is here: https://github.com/RobertoPrevato/KingTable/blob/master/source/code/scripts/tables/kingtable.html.builder.js at line 218.
When using this feature, it is your responsibility to escape unsafe strings, when necessary.
I hope this helps, if it works please close this issue, otherwise let me know.
awesome, thanks for the fast reply. I need to have a look through the source code, I've been working from the minified version and using the wiki pages for documentation. (which is where i got that code from: https://github.com/RobertoPrevato/KingTable/wiki/Common-tasks)
Thanks again.
Thanks for the heads up, I did a mistake not updating that piece of documentation - I will fix it. Unfortunately I am not dedicating so much time to this library, because it is something I did for passion, and I am active in many other things (Azure, Docker images, for example the last JavaScript library I published, for form validation, https://github.com/RobertoPrevato/DataEntry).
If I had more free time, I would definitely work more on it! :)
I've been trying to use the template option for a column so that a product name can link to another page, though I've been unable to get the template option to have any effect on the table.
I tried to recreate the example code (as above) directly to create a details link and that also causes no change in the table. I was just wondering if this feature's implementation is complete or if I should write my own little piece of javascript to add links within td tags?