Advertisement

02.07.2008 at 10:02AM PST, ID: 23145241
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

Ajax: Adding new rows to table.

Asked by tim_cs in JavaScript, Web Languages/Standards, Cold Fusion Markup Language

Tags: ,

I'm trying to figure out how to insert new rows into a table after making an Ajax call.  I want to insert the new rows right before the row I click on.  I have a cfc that I'm calling with Ajax and it's passing back the data already formatted into table rows.  Not sure of the best way of doing this.  Below is some of the code that I'm using.  Also, please let me know if I should do some of this a different way.


P.S. I'm using the ajax engine from lalabird.com

Thanks,
TimStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
<!---  The method I'm calling --->
<cffunction name="dailyTotals" access="remote"  returntype="void" output="true">
	<cfargument name="department" type="string" required="yes" />
 
	<cfstoredproc procedure="sp_OMR_qry_DailyHours" datasource="#session.database#" username="#session.DBID#" password="#session.DBPass#" >
		<cfprocparam type="in" cfsqltype="cf_sql_varchar" dbvarname="department" value="#arguments.department#" null="no" />
		<cfprocresult name="qry_dailyhours" resultset="1" />
	</cfstoredproc>
	
	
	<cfsavecontent variable="content">
		<cfoutput query="qry_dailyhours">
		<cfset sumHours = 0>
 
		<tr >
			<cfset rowClass = "reportDataRow#Int(qry_dailyhours.CurrentRow MOD 2)#">
			<td class="#rowClass#"></td>
			<td class="#rowClass#">#DateFormat(qry_dailyhours.recordDate, "MM/DD/YYYY")#</td>
			<!--- <td>#qry_dailyhours.TimecardWeek#</td> --->
			<!--- <td>#qry_hours.SupDepartment#</td> --->
			<td class="#rowClass#"><cfif #qry_dailyhours.Direct# EQ "">0<cfelse>#Round(qry_dailyhours.Direct)# <cfset sumHours = sumHours + qry_dailyhours.Direct></cfif></td>
			<td class="#rowClass#"><cfif #qry_dailyhours.indirect# EQ "">0<cfelse>#Round(qry_dailyhours.Indirect)# <cfset sumHours = sumHours + qry_dailyhours.Indirect></cfif></td>
			<td class="#rowClass#"><cfif #qry_dailyhours.Nonop# EQ "">0<cfelse>#Round(qry_dailyhours.NonOp)# <cfset sumHours = sumHours + qry_dailyhours.Nonop></cfif></td>
			<td class="#rowClass#">#Round(sumHours)#</td>
			<td class="#rowClass#">#Round(qry_dailyhours.OT)#</td>
			<td class="#rowClass#"><cfif sumHours NEQ '0'>#DecimalFormat((qry_dailyhours.OT/sumHours)*100)#%</cfif></td>
		</tr>
	
		</cfoutput>
	</cfsavecontent>
	
	<cfwddx action="CFML2JS" input="#content#" toplevelvariable="r">
</cffunction>
 
<!--- How I'm calling the method --->
	function get_week(department,weekend){ 
		param = 'department='+ department + '&weekend=' + weekend;
    	http( 'POST'  , 'components/ajax.cfc?method=dailyTotals' , add_rows, param); 
    }
 
What is the best way to write the add_rows function?
 
Loading Advertisement...
 
[+][-]02.08.2008 at 05:56AM PST, ID: 20850041

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Web Languages/Standards, Cold Fusion Markup Language
Tags: Coldfusion, Javascript, IE 6 & 7, Coldfusion 7
Sign Up Now!
Solution Provided By: HonorGod
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.08.2008 at 06:01AM PST, ID: 20850079

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.03.2008 at 08:24AM PST, ID: 21032996

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628