Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.