| <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 view this discussion on the web visit https://groups.google.com/d/msg/enlive-clj/-/1dl4Qjb9U_gJ.
You received this message because you are subscribed to the Google Groups "Enlive" group.
To post to this group, send email to enliv...@googlegroups.com.
To unsubscribe from this group, send email to enlive-clj+...@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 view this discussion on the web visit https://groups.google.com/d/msg/enlive-clj/-/1dl4Qjb9U_gJ.
To post to this group, send email to enliv...@googlegroups.com.
To unsubscribe from this group, send email to enlive-clj+...@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.
Very nice.
What's the purpose of the (nth-child 2) selector-step in this case?
Isn't there only one row in the template?
Isn't there only one row in the template?> It is there to select (and clone) teh 2nd row.
Ah, gotcha. Thanks for the solution and subsequent discussion.