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

ColdFusion, jQuery, <cfloop>

Engaged ,
Dec 06, 2011 Dec 06, 2011

Hi,

I am using CF 9 and jQuery.  I have a <cfloop> tag that I use to loop over some database records.  At each iteration of the loop I'm generating a progress bar using jQuery.  My code is something like this:

<table>

  <cfloop query="q">

      <tr>

         <td>#firstName#</td>

        <td>#lastName#</td>

         <td>

            <script type="text/javascript">

                   $(document).ready(function() {

                      $( "##progressbar#pkid#" ).progressbar({

                         value: #percentcomplete#

                       });

                    });

             </script>

          </td>

        </tr>

</cfloop>

</table>

The fields "pkid" and "percentcomplete" are coming back from my query.  I'm just looping over and generating a jQuery progress bar at each iteration. 

So my question is, is this the way I should be doing it?  As of now, I will have multiple $(document).ready() blocks which feels a bit weird, but I'm wondering how can I achieve the same result another way using ColdFusion and jQuery? 

Any thoughts would be really helpful.  So my code works and all is good, but is there another way I should be doing this?

Thanks

-Westside

TOPICS
Advanced techniques
1.3K
Translate
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 ,
Dec 07, 2011 Dec 07, 2011

I would be trying to launch the progress bar before the loop starts, and have it progress during the loop.  However, jQuery and progress bars are not my strengths so I don't actually know how to do it.

Translate
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
Engaged ,
Dec 07, 2011 Dec 07, 2011
LATEST

This progress bar is actually static for the most part.  The value of the bar is based of the data in a column in our database but it isn't like a progress bar that you might find whe you upload a file and the progress bar changes right on the page.  I'm just setting the value of the progress bar equal to the value in the database.

Translate
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