• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Displaying a query result in 3 columns

Participant ,
Sep 27, 2008 Sep 27, 2008

Copy link to clipboard

Copied

Hi

I have a query with n records. Now I would like to display all records in a HTML page in 3 columns. I don't have a clue on how to do that!

What I would like is (assuming I have 9 records in my query):

<div id="column1">
displaying records 1 to 3
</div>

<div id="column2">
displaying records 4 to 6
</div>

<div id="column3">
displaying records 7 to 9
</div>

Has anyone a short solution or at least a link to a sloution. I didn't find anything great yet...

Thank you & regards
TOPICS
Advanced techniques

Views

484

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Sep 28, 2008 Sep 28, 2008
Hi

I found a solution which works fine - unfortunately I don't really understand it :-)

Thank you for your inputs!

Votes

Translate

Translate
New Here ,
Sep 27, 2008 Sep 27, 2008

Copy link to clipboard

Copied

Try this

I loop throught td's and when i get my 3 count i end off with a tr and start a new tr

Enjoy,
Ernie

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 28, 2008 Sep 28, 2008

Copy link to clipboard

Copied

Unfortunately your solution doesn't satisfy me 100%ly. I think I would need something like a loop in a loop:

<cfloop query="myquery1">
<div id="column.myquery1">
<cfloop query="myquery2">
Record: myquery2.record
</cfloop>
</div>
</cfloop>

But this looks like a mess! The first loop should 'appear' 3 times because I want three DIVs being displayed on my HTML page. And then per DIV an 'equal' list of records. Assuming my query contains 9 records so there is 3 per DIV. If there is p.e. 11 records I would like to have
4 records in the first DIV
4 records in the second DIV
3 records in the third DIV

Thanks for hints

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 28, 2008 Sep 28, 2008

Copy link to clipboard

Copied

My recommendation is that if ever you have a problem, try googling for an
answer: that's usually the quickest way of finding a solution. I found a
bunch of answers googling "coldfusion output columns".

The second match covers the basics of your requirement, and you just need
to extrapolate slightly from there to get your answer. And a few of the
others on the first page of results also cover the same (well-trod) ground.

Hint: you need to two two different actions, one on every third row, and
one on every ninth row.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 28, 2008 Sep 28, 2008

Copy link to clipboard

Copied

Hi

I found a solution which works fine - unfortunately I don't really understand it :-)

Thank you for your inputs!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 28, 2008 Sep 28, 2008

Copy link to clipboard

Copied

LATEST
> I found a solution which works fine - unfortunately I don't really understand
> it :-)

What about it don't you understand? Wanna do something about understanding
it?

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation