Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion filling rows from struct-map
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gwanwyn  
View profile  
 More options Mar 30 2012, 9:10 am
From: gwanwyn <vesna.petko...@gmail.com>
Date: Fri, 30 Mar 2012 06:10:59 -0700 (PDT)
Local: Fri, Mar 30 2012 9:10 am
Subject: Re: filling rows from struct-map

I changed one thing in the template bellow, and this is more elegant now :

(deftemplate indeks table-template [{:keys  [title event-data]}]
  [:title] (html/content title)
  [:tr (html/nth-child 2)] (html/clone-for [event event-data]
                        [:td] #(-> % :attrs :title mapping event)))

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.

Cheers

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.