jquery-rss icon indicating copy to clipboard operation
jquery-rss copied to clipboard

layoutTemplate not working with <table>

Open mortenlein opened this issue 9 years ago • 3 comments
trafficstars

Hi,

When I do a layoutTemplate: '<table>{entries}</table>' it never adds the start nor the end of the table tag, it only produces the

tags within the entryTemplate.

I tried your examples in JSFiddle and I get the same results, so there is no interference from any other lib I am using in my project.

JSFIddle here; https://jsfiddle.net/AFHfn/2551/


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

mortenlein avatar Nov 15 '16 11:11 mortenlein

currently it is impossible, i think :( because jquery create a different objects structure from 'table' tag. compare its on browser console: $('<ul><entries></entries></ul>') and $('<table><entries></entries></table>') second object has two array members, moreover its .outerHTML not hold a <entries></entries>! its made as first member of array.

but you can make output rss entries in table by another way ;) add in your JSFiddle example next code - html:

<h2>Rss entries in table</h2>
<table id="rss2table"></table>

javascript:

$("#rss2table").rss("http://www.gosugamers.net/counterstrike/news/rss", {
    limit: 5,
    ssl: true,
    layoutTemplate: '{entries}',
    entryTemplate: '<tr><td><a href="{url}">{title}</a>{shortBodyPlain}[{author}@{date}]</td></tr>'
}).show();

myrises avatar Jan 01 '17 04:01 myrises

I will try that, thanks for the reply

mortenlein avatar Jan 11 '17 14:01 mortenlein

@myrises , It is interesting that you think tables are not possible for the time being (I have just tried, myself, with no success) but one of the examples in the readme goes like this:

$('#foo').rss(url, { layoutTemplate: "<table><tr><th>Title</th></tr>{entries}</table>", entryTemplate: "<tr><td>{title}</td></tr>" })

I now wonder if it should/did work, but does not anymore.

SimpleProgrammingAU avatar Jun 03 '18 00:06 SimpleProgrammingAU