I have a question, I want to fill rows in html table from a struct-map. I have a problem with row snippet, because I don't know how to define cell selectors. Each key value pair from my struct map is for one cell in a row. So my question is how do I define cell selectors, do I have to go one by one cell, or is there any other way to do it (there probably is one but I just can't seem to find it). I would probably need some kind of dynamic selector...
Here is my row html from the file index.html <tr> <td>Event Title</td> <td>Type of event</td> <td>Performer</td> <td>About</td> <td>Date</td> <td>Start time</td> <td>End time</td> <td>Place</td> <td>Video</td> </tr> Here are my selectors, snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child 2)][:td (html/nth-child 2)]]) (defsnippet second-cell "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value :value}] [:td] (html/content value)) (defsnippet row-model "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] (html/content (map model event-data))) (deftemplate index "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content (map #(row-model % cell-model % second-cell)rows))) and here is part of dummy-content struct-map, that I use for testing (def *dummy-content* {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" :performer "performer 1" :date "date 1" :start-time "start time 1" :end-time "start time 1"}]}]}) When I start the app, the table is blank, my code doesn't insert any content, and I can't seem to get the reason why. If anybody can give me the answer I'd be really grateful. Thanks Vesna
Also I added some changes to the html file <tbody title="events"> <tr title="event"> <td title="event-title">Event Title 1</td> <td title="performer">Performer1</td> <td title="date">Date1</td> <td title="start-time">Start time1</td> <td title="end-time">End time1</td>
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
If you name your map keys exactly as you name your titles, you can define a transformation that will reduce a lot of the repetition found in your solution. I did something similar w/ the 'class-as-kw-content' transformation found here:
> Also I added some changes to the html file > <tbody title="events"> > <tr title="event"> > <td title="event-title">Event Title 1</td> > <td title="performer">Performer1</td> > <td title="date">Date1</td> > <td title="start-time">Start time1</td> > <td title="end-time">End time1</td>
> </tr> > Cheers. > On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>> Hello everybody,
>> I have a question, I want to fill rows in html table from a struct-map. I >> have a problem with row snippet, because I don't know how to define cell >> selectors. Each key value pair from my struct map is for one cell in a row. >> So my question is how do I define cell selectors, do I have to go one by >> one cell, or is there any other way to do it (there probably is one but I >> just can't seem to find it). I would probably need some kind of dynamic >> selector...
>> Here is my row html from the file index.html >> <tr> >> <td>Event Title</td> >> <td>Type of event</td> >> <td>Performer</td> >> <td>About</td> >> <td>Date</td> >> <td>Start time</td> >> <td>End time</td> >> <td>Place</td> >> <td>Video</td> </tr> Here are my selectors, >> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >> :value}] [:td] (html/content value)) (defsnippet row-model >> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >> (html/content (map model event-data))) (deftemplate index >> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >> (map #(row-model % cell-model % second-cell)rows))) and here is part of >> dummy-content struct-map, that I use for testing (def *dummy-content* >> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >> :performer "performer 1" :date "date 1" :start-time "start time 1" >> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >> code doesn't insert any content, and I can't seem to get the reason why. If >> anybody can give me the answer I'd be really grateful. Thanks Vesna
> To post to this group, send email to enlive-clj@googlegroups.com. > To unsubscribe from this group, send email to > enlive-clj+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/enlive-clj?hl=en.
Using your latest HTML, something like this should also work (untested). Doing something purely positional (without the title attributes) is doable but more verbose.
> Also I added some changes to the html file > <tbody title="events"> > <tr title="event"> > <td title="event-title">Event Title 1</td> > <td title="performer">Performer1</td> > <td title="date">Date1</td> > <td title="start-time">Start time1</td> > <td title="end-time">End time1</td>
> </tr> > Cheers. > On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>> Hello everybody,
>> I have a question, I want to fill rows in html table from a struct-map. I >> have a problem with row snippet, because I don't know how to define cell >> selectors. Each key value pair from my struct map is for one cell in a row. >> So my question is how do I define cell selectors, do I have to go one by >> one cell, or is there any other way to do it (there probably is one but I >> just can't seem to find it). I would probably need some kind of dynamic >> selector...
>> Here is my row html from the file index.html >> <tr> >> <td>Event Title</td> >> <td>Type of event</td> >> <td>Performer</td> >> <td>About</td> >> <td>Date</td> >> <td>Start time</td> >> <td>End time</td> >> <td>Place</td> >> <td>Video</td> </tr> Here are my selectors, >> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >> :value}] [:td] (html/content value)) (defsnippet row-model >> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >> (html/content (map model event-data))) (deftemplate index >> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >> (map #(row-model % cell-model % second-cell)rows))) and here is part of >> dummy-content struct-map, that I use for testing (def *dummy-content* >> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >> :performer "performer 1" :date "date 1" :start-time "start time 1" >> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >> code doesn't insert any content, and I can't seem to get the reason why. If >> anybody can give me the answer I'd be really grateful. Thanks Vesna
> To post to this group, send email to enlive-clj@googlegroups.com. > To unsubscribe from this group, send email to > enlive-clj+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/enlive-clj?hl=en.
event-data was in brackets, and it shouldn't have been, it was giving null pointer exception. However, now it won't fill the tds with content. I am looking for the solution.
Joe, I will definitely try your solution.
Thank you both, and if you anyone can find the bug in the template above, I'd be most grateful.
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
> Using your latest HTML, something like this should also work (untested). > Doing something purely positional (without the title attributes) is doable > but more verbose.
>> Also I added some changes to the html file >> <tbody title="events"> >> <tr title="event"> >> <td title="event-title">Event Title 1</td> >> <td title="performer">Performer1</td> >> <td title="date">Date1</td> >> <td title="start-time">Start time1</td> >> <td title="end-time">End time1</td>
>> </tr> >> Cheers. >> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html >>> <tr> >>> <td>Event Title</td> >>> <td>Type of event</td> >>> <td>Performer</td> >>> <td>About</td> >>> <td>Date</td> >>> <td>Start time</td> >>> <td>End time</td> >>> <td>Place</td> >>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>> To post to this group, send email to enlive-clj@googlegroups.com. >> To unsubscribe from this group, send email to >> enlive-clj+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/enlive-clj?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "Enlive" group. > To post to this group, send email to enlive-clj@googlegroups.com. > To unsubscribe from this group, send email to > enlive-clj+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/enlive-clj?hl=en.
On Fri, Mar 30, 2012 at 9:18 AM, Christophe Grand <christo...@cgrand.net> wrote: > On Fri, Mar 30, 2012 at 3:13 PM, Joe Snikeris <j...@snikeris.com> wrote:
>> Very nice.
>> What's the purpose of the (nth-child 2) selector-step in this case?
On Fri, Mar 30, 2012 at 9:25 AM, Christophe Grand <christo...@cgrand.net> wrote: > On Fri, Mar 30, 2012 at 3:22 PM, Joe Snikeris <j...@snikeris.com> wrote:
>> > It is there to select (and clone) teh 2nd row.
>> Isn't there only one row in the template?
> Not from what I inferred from his original code.
Ah, gotcha. Thanks for the solution and subsequent discussion.
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
> Hello everybody,
> I have a question, I want to fill rows in html table from a struct-map. I > have a problem with row snippet, because I don't know how to define cell > selectors. Each key value pair from my struct map is for one cell in a row. > So my question is how do I define cell selectors, do I have to go one by > one cell, or is there any other way to do it (there probably is one but I > just can't seem to find it). I would probably need some kind of dynamic > selector...
> Here is my row html from the file index.html > <tr> > <td>Event Title</td> > <td>Type of event</td> > <td>Performer</td> > <td>About</td> > <td>Date</td> > <td>Start time</td> > <td>End time</td> > <td>Place</td> > <td>Video</td> </tr> Here are my selectors, > snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td > html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child > 2)][:td (html/nth-child 2)]]) (defsnippet second-cell > "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td > (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) > (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value > :value}] [:td] (html/content value)) (defsnippet row-model > "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] > (html/content (map model event-data))) (deftemplate index > "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content > (map #(row-model % cell-model % second-cell)rows))) and here is part of > dummy-content struct-map, that I use for testing (def *dummy-content* > {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" > :performer "performer 1" :date "date 1" :start-time "start time 1" > :end-time "start time 1"}]}]}) When I start the app, the table is blank, my > code doesn't insert any content, and I can't seem to get the reason why. If > anybody can give me the answer I'd be really grateful. Thanks Vesna
On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
> I tried this
> [[:tr (attr= :title "event")]]
> to select the row, but now it's completely out. Trying some more....
> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>> Hello everybody,
>> I have a question, I want to fill rows in html table from a struct-map. I >> have a problem with row snippet, because I don't know how to define cell >> selectors. Each key value pair from my struct map is for one cell in a row. >> So my question is how do I define cell selectors, do I have to go one by >> one cell, or is there any other way to do it (there probably is one but I >> just can't seem to find it). I would probably need some kind of dynamic >> selector...
>> Here is my row html from the file index.html >> <tr> >> <td>Event Title</td> >> <td>Type of event</td> >> <td>Performer</td> >> <td>About</td> >> <td>Date</td> >> <td>Start time</td> >> <td>End time</td> >> <td>Place</td> >> <td>Video</td> </tr> Here are my selectors, >> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >> :value}] [:td] (html/content value)) (defsnippet row-model >> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >> (html/content (map model event-data))) (deftemplate index >> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >> (map #(row-model % cell-model % second-cell)rows))) and here is part of >> dummy-content struct-map, that I use for testing (def *dummy-content* >> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >> :performer "performer 1" :date "date 1" :start-time "start time 1" >> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >> code doesn't insert any content, and I can't seem to get the reason why. If >> anybody can give me the answer I'd be really grateful. Thanks Vesna
> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>> Hello everybody,
>> I have a question, I want to fill rows in html table from a struct-map. I >> have a problem with row snippet, because I don't know how to define cell >> selectors. Each key value pair from my struct map is for one cell in a row. >> So my question is how do I define cell selectors, do I have to go one by >> one cell, or is there any other way to do it (there probably is one but I >> just can't seem to find it). I would probably need some kind of dynamic >> selector...
>> Here is my row html from the file index.html >> <tr> >> <td>Event Title</td> >> <td>Type of event</td> >> <td>Performer</td> >> <td>About</td> >> <td>Date</td> >> <td>Start time</td> >> <td>End time</td> >> <td>Place</td> >> <td>Video</td> </tr> Here are my selectors, >> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >> :value}] [:td] (html/content value)) (defsnippet row-model >> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >> (html/content (map model event-data))) (deftemplate index >> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >> (map #(row-model % cell-model % second-cell)rows))) and here is part of >> dummy-content struct-map, that I use for testing (def *dummy-content* >> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >> :performer "performer 1" :date "date 1" :start-time "start time 1" >> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >> code doesn't insert any content, and I can't seem to get the reason why. If >> anybody can give me the answer I'd be really grateful. Thanks Vesna
> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>> Hello everybody,
>> I have a question, I want to fill rows in html table from a struct-map. I >> have a problem with row snippet, because I don't know how to define cell >> selectors. Each key value pair from my struct map is for one cell in a row. >> So my question is how do I define cell selectors, do I have to go one by >> one cell, or is there any other way to do it (there probably is one but I >> just can't seem to find it). I would probably need some kind of dynamic >> selector...
>> Here is my row html from the file index.html >> <tr> >> <td>Event Title</td> >> <td>Type of event</td> >> <td>Performer</td> >> <td>About</td> >> <td>Date</td> >> <td>Start time</td> >> <td>End time</td> >> <td>Place</td> >> <td>Video</td> </tr> Here are my selectors, >> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >> :value}] [:td] (html/content value)) (defsnippet row-model >> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >> (html/content (map model event-data))) (deftemplate index >> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >> (map #(row-model % cell-model % second-cell)rows))) and here is part of >> dummy-content struct-map, that I use for testing (def *dummy-content* >> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >> :performer "performer 1" :date "date 1" :start-time "start time 1" >> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >> code doesn't insert any content, and I can't seem to get the reason why. If >> anybody can give me the answer I'd be really grateful. Thanks Vesna
> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>> I tried this
>> [[:tr (attr= :title "event")]]
>> to select the row, but now it's completely out. Trying some more....
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>> I tried this
>> [[:tr (attr= :title "event")]]
>> to select the row, but now it's completely out. Trying some more....
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>> Hello everybody,
>>> I have a question, I want to fill rows in html table from a struct-map. >>> I have a problem with row snippet, because I don't know how to define cell >>> selectors. Each key value pair from my struct map is for one cell in a row. >>> So my question is how do I define cell selectors, do I have to go one by >>> one cell, or is there any other way to do it (there probably is one but I >>> just can't seem to find it). I would probably need some kind of dynamic >>> selector...
>>> Here is my row html from the file index.html
>>> <tr>
>>> <td>Event Title</td>
>>> <td>Type of event</td>
>>> <td>Performer</td>
>>> <td>About</td>
>>> <td>Date</td>
>>> <td>Start time</td>
>>> <td>End time</td>
>>> <td>Place</td>
>>> <td>Video</td> </tr> Here are my selectors, >>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>> :value}] [:td] (html/content value)) (defsnippet row-model >>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>> (html/content (map model event-data))) (deftemplate index >>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>> dummy-content struct-map, that I use for testing (def *dummy-content* >>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>> code doesn't insert any content, and I can't seem to get the reason why. If >>> anybody can give me the answer I'd be really grateful. Thanks Vesna
You should put event-data in square brackets, like this
[{ :event-name "event name 1"
:performer "performer 1"
:date "date 1"
:start-time "start time 1"
:end-time "end time 1"}]
>> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>>> I tried this
>>> [[:tr (attr= :title "event")]]
>>> to select the row, but now it's completely out. Trying some more....
>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>> Hello everybody,
>>>> I have a question, I want to fill rows in html table from a struct-map. >>>> I have a problem with row snippet, because I don't know how to define cell >>>> selectors. Each key value pair from my struct map is for one cell in a row. >>>> So my question is how do I define cell selectors, do I have to go one by >>>> one cell, or is there any other way to do it (there probably is one but I >>>> just can't seem to find it). I would probably need some kind of dynamic >>>> selector...
>>>> Here is my row html from the file index.html
>>>> <tr>
>>>> <td>Event Title</td>
>>>> <td>Type of event</td>
>>>> <td>Performer</td>
>>>> <td>About</td>
>>>> <td>Date</td>
>>>> <td>Start time</td>
>>>> <td>End time</td>
>>>> <td>Place</td>
>>>> <td>Video</td> </tr> Here are my selectors, >>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>> (html/content (map model event-data))) (deftemplate index >>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>> Hello everybody,
>>>> I have a question, I want to fill rows in html table from a struct-map. >>>> I have a problem with row snippet, because I don't know how to define cell >>>> selectors. Each key value pair from my struct map is for one cell in a row. >>>> So my question is how do I define cell selectors, do I have to go one by >>>> one cell, or is there any other way to do it (there probably is one but I >>>> just can't seem to find it). I would probably need some kind of dynamic >>>> selector...
>>>> Here is my row html from the file index.html
>>>> <tr>
>>>> <td>Event Title</td>
>>>> <td>Type of event</td>
>>>> <td>Performer</td>
>>>> <td>About</td>
>>>> <td>Date</td>
>>>> <td>Start time</td>
>>>> <td>End time</td>
>>>> <td>Place</td>
>>>> <td>Video</td> </tr> Here are my selectors, >>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>> (html/content (map model event-data))) (deftemplate index >>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>> Hello everybody,
>>>> I have a question, I want to fill rows in html table from a struct-map. >>>> I have a problem with row snippet, because I don't know how to define cell >>>> selectors. Each key value pair from my struct map is for one cell in a row. >>>> So my question is how do I define cell selectors, do I have to go one by >>>> one cell, or is there any other way to do it (there probably is one but I >>>> just can't seem to find it). I would probably need some kind of dynamic >>>> selector...
>>>> Here is my row html from the file index.html
>>>> <tr>
>>>> <td>Event Title</td>
>>>> <td>Type of event</td>
>>>> <td>Performer</td>
>>>> <td>About</td>
>>>> <td>Date</td>
>>>> <td>Start time</td>
>>>> <td>End time</td>
>>>> <td>Place</td>
>>>> <td>Video</td> </tr> Here are my selectors, >>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>> (html/content (map model event-data))) (deftemplate index >>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
Does your template only contains a tr like that :
_________________________
<tr>
<td title="event-name">Event Title 1</td>
<td title="performer">Performer1</td>
<td title="date">Date1</td>
<td title="start-time">Start time1</td>
<td title="end-time">End time1</td>
</tr>
___________________
?
Le mardi 17 avril 2012 15:48:38 UTC+2, gwanwyn a écrit :
> You should put event-data in square brackets, like this
> [{ :event-name "event name 1"
> :performer "performer 1"
> :date "date 1"
> :start-time "start time 1"
> :end-time "end time 1"}]
> Hope this solves your problem...
> On Tuesday, April 17, 2012 3:34:40 PM UTC+2, Pierre-Henry Perret wrote:
>> I've tried gwanwyn's code with that content:
>> __________________________
>> (def content-t
>> {:title "Events Mashup"
>> :cont "voici le contenu"
>> :event-data
>> {:event-name "event name 1"
>> :performer "performer 1"
>> :date "date 1"
>> :start-time "start time 1"
>> :end-time "start time 1"}
>> })
>> ______________________________
>> But it produces nothing.
>> Am I correct ?
>> Le mardi 3 avril 2012 18:17:51 UTC+2, gwanwyn a écrit :
>>> I'd answer sooner, but was heavy with flu.
>>> This is what deftemplate should look like, it works fine.
>>> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>>>> I tried this
>>>> [[:tr (attr= :title "event")]]
>>>> to select the row, but now it's completely out. Trying some more....
>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>> Hello everybody,
>>>>> I have a question, I want to fill rows in html table from a >>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>> define cell selectors. Each key value pair from my struct map is for one >>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>> to go one by one cell, or is there any other way to do it (there probably >>>>> is one but I just can't seem to find it). I would probably need some kind >>>>> of dynamic selector...
>>>>> Here is my row html from the file index.html
>>>>> <tr>
>>>>> <td>Event Title</td>
>>>>> <td>Type of event</td>
>>>>> <td>Performer</td>
>>>>> <td>About</td>
>>>>> <td>Date</td>
>>>>> <td>Start time</td>
>>>>> <td>End time</td>
>>>>> <td>Place</td>
>>>>> <td>Video</td> </tr> Here are my selectors, >>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>> (html/content (map model event-data))) (deftemplate index >>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>> Hello everybody,
>>>>> I have a question, I want to fill rows in html table from a >>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>> define cell selectors. Each key value pair from my struct map is for one >>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>> to go one by one cell, or is there any other way to do it (there probably >>>>> is one but I just can't seem to find it). I would probably need some kind >>>>> of dynamic selector...
>>>>> Here is my row html from the file index.html
>>>>> <tr>
>>>>> <td>Event Title</td>
>>>>> <td>Type of event</td>
>>>>> <td>Performer</td>
>>>>> <td>About</td>
>>>>> <td>Date</td>
>>>>> <td>Start time</td>
>>>>> <td>End time</td>
>>>>> <td>Place</td>
>>>>> <td>Video</td> </tr> Here are my selectors, >>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>> (html/content (map model event-data))) (deftemplate index >>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>> Hello everybody,
>>>>> I have a question, I want to fill rows in html table from a >>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>> define cell selectors. Each key value pair from my struct map is for one >>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>> to go one by one cell, or is there any other way to do it (there probably >>>>> is one but I just can't seem to find it). I would probably need some kind >>>>> of dynamic selector...
>>>>> Here is my row html from the file index.html
>>>>> <tr>
>>>>> <td>Event Title</td>
>>>>> <td>Type of event</td>
>>>>> <td>Performer</td>
>>>>> <td>About</td>
>>>>> <td>Date</td>
>>>>> <td>Start time</td>
>>>>> <td>End time</td>
>>>>> <td>Place</td>
>>>>> <td>Video</td> </tr> Here are my selectors, >>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>> (html/content (map model event-data))) (deftemplate index >>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
it works for me, my template contains 2 trs, one for the header, and the other for the row, here it is
<tr class="main">
<td >Event Title</td>
<td>Performer</td>
<td>Date</td>
<td>Start time</td>
<td>End time</td>
<tr title="event">
<td title="event-title">Event Title 1</td>
<td title="performer">Performer1</td>
<td title="date">Date1</td>
<td title="start-time">Start time1</td>
<td title="end-time">End time1</td>
On Tuesday, April 17, 2012 4:12:51 PM UTC+2, Pierre-Henry Perret wrote:
> Nope.. yest not !
> Does your template only contains a tr like that :
> _________________________
> <tr>
> <td title="event-name">Event Title 1</td>
> <td title="performer">Performer1</td>
> <td title="date">Date1</td>
> <td title="start-time">Start time1</td>
> <td title="end-time">End time1</td>
> </tr>
> ___________________
> ?
> Le mardi 17 avril 2012 15:48:38 UTC+2, gwanwyn a écrit :
>> You should put event-data in square brackets, like this
>> [{ :event-name "event name 1"
>> :performer "performer 1"
>> :date "date 1"
>> :start-time "start time 1"
>> :end-time "end time 1"}]
>> Hope this solves your problem...
>> On Tuesday, April 17, 2012 3:34:40 PM UTC+2, Pierre-Henry Perret wrote:
>>> I've tried gwanwyn's code with that content:
>>> __________________________
>>> (def content-t
>>> {:title "Events Mashup"
>>> :cont "voici le contenu"
>>> :event-data
>>> {:event-name "event name 1"
>>> :performer "performer 1"
>>> :date "date 1"
>>> :start-time "start time 1"
>>> :end-time "start time 1"}
>>> })
>>> ______________________________
>>> But it produces nothing.
>>> Am I correct ?
>>> Le mardi 3 avril 2012 18:17:51 UTC+2, gwanwyn a écrit :
>>>> I'd answer sooner, but was heavy with flu.
>>>> This is what deftemplate should look like, it works fine.
>>>> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>>>>> I tried this
>>>>> [[:tr (attr= :title "event")]]
>>>>> to select the row, but now it's completely out. Trying some more....
>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>> Hello everybody,
>>>>>> I have a question, I want to fill rows in html table from a >>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>> of dynamic selector...
>>>>>> Here is my row html from the file index.html
>>>>>> <tr>
>>>>>> <td>Event Title</td>
>>>>>> <td>Type of event</td>
>>>>>> <td>Performer</td>
>>>>>> <td>About</td>
>>>>>> <td>Date</td>
>>>>>> <td>Start time</td>
>>>>>> <td>End time</td>
>>>>>> <td>Place</td>
>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>> (html/content (map model event-data))) (deftemplate index >>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>> Hello everybody,
>>>>>> I have a question, I want to fill rows in html table from a >>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>> of dynamic selector...
>>>>>> Here is my row html from the file index.html
>>>>>> <tr>
>>>>>> <td>Event Title</td>
>>>>>> <td>Type of event</td>
>>>>>> <td>Performer</td>
>>>>>> <td>About</td>
>>>>>> <td>Date</td>
>>>>>> <td>Start time</td>
>>>>>> <td>End time</td>
>>>>>> <td>Place</td>
>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>> (html/content (map model event-data))) (deftemplate index >>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>> Hello everybody,
>>>>>> I have a question, I want to fill rows in html table from a >>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>> of dynamic selector...
>>>>>> Here is my row html from the file index.html
>>>>>> <tr>
>>>>>> <td>Event Title</td>
>>>>>> <td>Type of event</td>
>>>>>> <td>Performer</td>
>>>>>> <td>About</td>
>>>>>> <td>Date</td>
>>>>>> <td>Start time</td>
>>>>>> <td>End time</td>
>>>>>> <td>Place</td>
>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>> (html/content (map model event-data))) (deftemplate index >>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>> anybody can give me the answer I'd be
> it works for me, my template contains 2 trs, one for the header, and the > other for the row, here it is
> <tr class="main">
> <td >Event Title</td>
> <td>Performer</td>
> <td>Date</td>
> <td>Start time</td>
> <td>End time</td>
> <tr title="event">
> <td title="event-title">Event Title 1</td>
> <td title="performer">Performer1</td>
> <td title="date">Date1</td>
> <td title="start-time">Start time1</td>
> <td title="end-time">End time1</td>
> </tr>
> hope, you'll find the solution.
> On Tuesday, April 17, 2012 4:12:51 PM UTC+2, Pierre-Henry Perret wrote:
>> Nope.. yest not !
>> Does your template only contains a tr like that :
>> _________________________
>> <tr>
>> <td title="event-name">Event Title 1</td>
>> <td title="performer">Performer1</td>
>> <td title="date">Date1</td>
>> <td title="start-time">Start time1</td>
>> <td title="end-time">End time1</td>
>> </tr>
>> ___________________
>> ?
>> Le mardi 17 avril 2012 15:48:38 UTC+2, gwanwyn a écrit :
>>> You should put event-data in square brackets, like this
>>> [{ :event-name "event name 1"
>>> :performer "performer 1"
>>> :date "date 1"
>>> :start-time "start time 1"
>>> :end-time "end time 1"}]
>>> Hope this solves your problem...
>>> On Tuesday, April 17, 2012 3:34:40 PM UTC+2, Pierre-Henry Perret wrote:
>>>> I've tried gwanwyn's code with that content:
>>>> __________________________
>>>> (def content-t
>>>> {:title "Events Mashup"
>>>> :cont "voici le contenu"
>>>> :event-data
>>>> {:event-name "event name 1"
>>>> :performer "performer 1"
>>>> :date "date 1"
>>>> :start-time "start time 1"
>>>> :end-time "start time 1"}
>>>> })
>>>> ______________________________
>>>> But it produces nothing.
>>>> Am I correct ?
>>>> Le mardi 3 avril 2012 18:17:51 UTC+2, gwanwyn a écrit :
>>>>> I'd answer sooner, but was heavy with flu.
>>>>> This is what deftemplate should look like, it works fine.
>>>>> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>>>>>> I tried this
>>>>>> [[:tr (attr= :title "event")]]
>>>>>> to select the row, but now it's completely out. Trying some more....
>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>> Hello everybody,
>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>> of dynamic selector...
>>>>>>> Here is my row html from the file index.html
>>>>>>> <tr>
>>>>>>> <td>Event Title</td>
>>>>>>> <td>Type of event</td>
>>>>>>> <td>Performer</td>
>>>>>>> <td>About</td>
>>>>>>> <td>Date</td>
>>>>>>> <td>Start time</td>
>>>>>>> <td>End time</td>
>>>>>>> <td>Place</td>
>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>>> (html/content (map model event-data))) (deftemplate index >>>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>> Hello everybody,
>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>> of dynamic selector...
>>>>>>> Here is my row html from the file index.html
>>>>>>> <tr>
>>>>>>> <td>Event Title</td>
>>>>>>> <td>Type of event</td>
>>>>>>> <td>Performer</td>
>>>>>>> <td>About</td>
>>>>>>> <td>Date</td>
>>>>>>> <td>Start time</td>
>>>>>>> <td>End time</td>
>>>>>>> <td>Place</td>
>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>>> (html/content (map model event-data))) (deftemplate index >>>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>> Hello everybody,
>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>> of dynamic selector...
>>>>>>> Here is my row html from the file index.html
>>>>>>> <tr>
>>>>>>> <td>Event Title</td>
>>>>>>> <td>Type of event</td>
>>>>>>> <td>Performer</td>
>>>>>>> <td>About</td>
>>>>>>> <td>Date</td>
>>>>>>> <td>Start time</td>
>>>>>>> <td>End time</td>
>>>>>>> <td>Place</td>
>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>>> (html/content (map model event-data))) (deftemplate index >>>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>>> dummy-content
On Tuesday, April 17, 2012 10:10:03 PM UTC+2, Pierre-Henry Perret wrote:
> Thanks, and sorry for the spam, the groups client told me a message was > suppressed, so I wrote another...
> which resulted in two posts!
> Le mardi 17 avril 2012 21:31:49 UTC+2, gwanwyn a écrit :
>> it works for me, my template contains 2 trs, one for the header, and the >> other for the row, here it is
>> <tr class="main">
>> <td >Event Title</td>
>> <td>Performer</td>
>> <td>Date</td>
>> <td>Start time</td>
>> <td>End time</td>
>> <tr title="event">
>> <td title="event-title">Event Title 1</td>
>> <td title="performer">Performer1</td>
>> <td title="date">Date1</td>
>> <td title="start-time">Start time1</td>
>> <td title="end-time">End time1</td>
>> </tr>
>> hope, you'll find the solution.
>> On Tuesday, April 17, 2012 4:12:51 PM UTC+2, Pierre-Henry Perret wrote:
>>> Nope.. yest not !
>>> Does your template only contains a tr like that :
>>> _________________________
>>> <tr>
>>> <td title="event-name">Event Title 1</td>
>>> <td title="performer">Performer1</td>
>>> <td title="date">Date1</td>
>>> <td title="start-time">Start time1</td>
>>> <td title="end-time">End time1</td>
>>> </tr>
>>> ___________________
>>> ?
>>> Le mardi 17 avril 2012 15:48:38 UTC+2, gwanwyn a écrit :
>>>> You should put event-data in square brackets, like this
>>>> [{ :event-name "event name 1"
>>>> :performer "performer 1"
>>>> :date "date 1"
>>>> :start-time "start time 1"
>>>> :end-time "end time 1"}]
>>>> Hope this solves your problem...
>>>> On Tuesday, April 17, 2012 3:34:40 PM UTC+2, Pierre-Henry Perret wrote:
>>>>> I've tried gwanwyn's code with that content:
>>>>> __________________________
>>>>> (def content-t
>>>>> {:title "Events Mashup"
>>>>> :cont "voici le contenu"
>>>>> :event-data
>>>>> {:event-name "event name 1"
>>>>> :performer "performer 1"
>>>>> :date "date 1"
>>>>> :start-time "start time 1"
>>>>> :end-time "start time 1"}
>>>>> })
>>>>> ______________________________
>>>>> But it produces nothing.
>>>>> Am I correct ?
>>>>> Le mardi 3 avril 2012 18:17:51 UTC+2, gwanwyn a écrit :
>>>>>> I'd answer sooner, but was heavy with flu.
>>>>>> This is what deftemplate should look like, it works fine.
>>>>>> On Friday, March 30, 2012 3:38:10 PM UTC+2, gwanwyn wrote:
>>>>>>> I tried this
>>>>>>> [[:tr (attr= :title "event")]]
>>>>>>> to select the row, but now it's completely out. Trying some more....
>>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>>> Hello everybody,
>>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>>> of dynamic selector...
>>>>>>>> Here is my row html from the file index.html
>>>>>>>> <tr>
>>>>>>>> <td>Event Title</td>
>>>>>>>> <td>Type of event</td>
>>>>>>>> <td>Performer</td>
>>>>>>>> <td>About</td>
>>>>>>>> <td>Date</td>
>>>>>>>> <td>Start time</td>
>>>>>>>> <td>End time</td>
>>>>>>>> <td>Place</td>
>>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>>>> (html/content (map model event-data))) (deftemplate index >>>>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>>> Hello everybody,
>>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>>> of dynamic selector...
>>>>>>>> Here is my row html from the file index.html
>>>>>>>> <tr>
>>>>>>>> <td>Event Title</td>
>>>>>>>> <td>Type of event</td>
>>>>>>>> <td>Performer</td>
>>>>>>>> <td>About</td>
>>>>>>>> <td>Date</td>
>>>>>>>> <td>Start time</td>
>>>>>>>> <td>End time</td>
>>>>>>>> <td>Place</td>
>>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model >>>>>>>> "eventsmashup/index.html" *row-sel* [{:keys [event-data]} model] [:tr] >>>>>>>> (html/content (map model event-data))) (deftemplate index >>>>>>>> "eventsmashup/index.html" [{:keys [event-data]}] [:tbody] (html/content >>>>>>>> (map #(row-model % cell-model % second-cell)rows))) and here is part of >>>>>>>> dummy-content struct-map, that I use for testing (def *dummy-content* >>>>>>>> {:title "Events Mashup" :rows [ { :event-data [{:event-name "event name 1" >>>>>>>> :performer "performer 1" :date "date 1" :start-time "start time 1" >>>>>>>> :end-time "start time 1"}]}]}) When I start the app, the table is blank, my >>>>>>>> code doesn't insert any content, and I can't seem to get the reason why. If >>>>>>>> anybody can give me the answer I'd be really grateful. Thanks Vesna
>>>>>>> On Thursday, December 22, 2011 8:41:52 PM UTC+1, gwanwyn wrote:
>>>>>>>> Hello everybody,
>>>>>>>> I have a question, I want to fill rows in html table from a >>>>>>>> struct-map. I have a problem with row snippet, because I don't know how to >>>>>>>> define cell selectors. Each key value pair from my struct map is for one >>>>>>>> cell in a row. So my question is how do I define cell selectors, do I have >>>>>>>> to go one by one cell, or is there any other way to do it (there probably >>>>>>>> is one but I just can't seem to find it). I would probably need some kind >>>>>>>> of dynamic selector...
>>>>>>>> Here is my row html from the file index.html
>>>>>>>> <tr>
>>>>>>>> <td>Event Title</td>
>>>>>>>> <td>Type of event</td>
>>>>>>>> <td>Performer</td>
>>>>>>>> <td>About</td>
>>>>>>>> <td>Date</td>
>>>>>>>> <td>Start time</td>
>>>>>>>> <td>End time</td>
>>>>>>>> <td>Place</td>
>>>>>>>> <td>Video</td> </tr> Here are my selectors, >>>>>>>> snippets and template (def *first-cell-sel* [[:tr (html/nth-child 1)][:td >>>>>>>> html/first-child]]) (def *rest-cell-sel* [[:table] [:tr (html/nth-child >>>>>>>> 2)][:td (html/nth-child 2)]]) (defsnippet second-cell >>>>>>>> "eventsmashup/index.html" [[:table] [:tr (html/nth-child 1)][:td >>>>>>>> (html/nth-child 2)]] [{value :performer}] [:td] (html/content value)) >>>>>>>> (defsnippet cell-model "eventsmashup/index.html" *first-cell-sel* [{value >>>>>>>> :value}] [:td] (html/content value)) (defsnippet row-model