Solved

(Help please) Adding an ad icon to my parent and child list

Posted on 2014-03-25
8
245 Views
Last Modified: 2014-03-25
Hi,

I have a parent and child list that I need to add an (ad icon) to the list.

the output should look just like in the image.  If the record is a child the ad icon should be added to the end of the list. If the record is a parent the ad icon should be added right after it.  

I need your help please.

Thanks,
Lulu



<cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
<!-- //Parent Row -->
 <tr class="bgrow">
   <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
 <td style="font-weight:bold;">#QSearchResult.Category#</td>
 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
 <td style="font-weight:bold;">#QSearchResult.Status#</td>
  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
  <img src="images/view.png" alt="View Sub Issue" />
  </td>
  </tr>
  
 </cfif>

Open in new window




 <tr class="bg2row">
    <td colspan="6" style="text-align:right;">
      <a href="LogEntry.cfm?AID=#QSearchResult.ParentIssueID#"><img src="images/add.png" alt="Add Sub Issue" /></a>
    </td>
    <td>
    </td>
    </tr>

Open in new window


ad
0
Comment
Question by:lulu50
  • 5
  • 3
8 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 39953359
Hi Lulu,
I know it seems complex to figure out the pattern of when to display the icon, after a parent if no children (how do you know if there are children?)  and after the last child, (how do you know if its the last child?)

But think of it this way.   The icon appears BEFORE every parent record.   So, that's a much easier way to think of it when coding.  Before drawing a parent record, you need to show this Add Icon from the previous set of records regardless of whether there are children or not.

The exception is, that you don't want to show it for the first parent record (because there is nothing before it).    The only challenge then is to know what the ID is of the ID before the parent you are drawing.  So we will just put in a variable to remember the previous ID.

Check this out...

<cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
    <td style="padding-left:20px;">#QSearchResult.issueID#</td>
    <td>#QSearchResult.ticketNumber#</td>
    <td>#QSearchResult.Category#</td>
    <td>#QSearchResult.TitleOfIssue#</td>
    <td>#QSearchResult.Status#</td>
    <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td>
	  <a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
      <img src="images/view.png" alt="View Sub Issue" />
    </td>
  </tr>  
<cfelse>
<!-- //Parent Row -->
 <cfif QSearchResult.currentRow gt 1 and val(previousParentIssueID)>
 <tr>
   <td colspan="6">&nbsp;</td>
   <td><a href="AddChild.cfm?EID=#previousParentIssueID#"><img src="images/AddChild.png" alt="Add Child" /></a>
 </tr>
 </cfif>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
	  </td>
  </tr>
</cfif>
<cfset previousParentIssueID = QSearchResult.ParentIssueID>

Open in new window

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39953368
As a side note, I also think the page would look good if you just place the icon on the same line as the parent (with the other two icons).   That would save you a lot of rows that are there just for the Add icon.   BUt that's up to you and your clients... just my 2 cents.
0
 

Author Comment

by:lulu50
ID: 39953825
gdemaria,

I made the changes but, I only able to have one add in one of the parents.

Yes, I agree I should not have an extra row for the ad

<cfoutput query="QSearchResult" startrow="#start_record#" maxrows="#records_per_page#">

 <cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?TechType=#QSearchResult.CategoryTypeID#&ID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
      <cfif QSearchResult.currentRow gt 1 and val(previousParentIssueID)>
      <a href="AddChild.cfm?EID=#previousParentIssueID#"><img src="images/add.png" alt="Add Child" /></a>
      </cfif>
      
	  </td>
  </tr>
</cfif>
<cfset previousParentIssueID = QSearchResult.ParentIssueID> 

 
</cfoutput>

Open in new window




as
0
 

Author Comment

by:lulu50
ID: 39953853
I got it!!!!!!!!!!
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:lulu50
ID: 39953872
It's working!!!!!!!!!!!!

this is what I did.

<cfset previousParentIssueID = QSearchResult.ParentIssueID> 
<cfoutput query="QSearchResult" startrow="#start_record#" maxrows="#records_per_page#">

 <cfif val(QSearchResult.ParentIssueID)> 
 <!-- //Child Row -->
 <tr class="bg2row">
   <td style="padding-left:20px;">#QSearchResult.issueID#</td>
 <td>#QSearchResult.ticketNumber#</td>
 <td>#QSearchResult.Category#</td>
 <td>#QSearchResult.TitleOfIssue#</td>
 <td>#QSearchResult.Status#</td>
  <td>#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
    <td><a href="LogEntry.cfm?TechType=#QSearchResult.CategoryTypeID#&ID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
    <img src="images/view.png" alt="View Sub Issue" />
    </td>
    </tr>  
 <cfelse>
 <tr class="bgrow">
	 <td style="font-weight:bold;padding-left:5px;">#QSearchResult.issueID#</td>
	 <td style="font-weight:bold;">#QSearchResult.TicketNumber#</td>
	 <td style="font-weight:bold;">#QSearchResult.Category#</td>
	 <td style="font-weight:bold;">#QSearchResult.TitleOfIssue#</td>
	 <td style="font-weight:bold;">#QSearchResult.Status#</td>
	  <td style="font-weight:bold;">#DateFormat(QSearchResult.DateCreated, "m/d/yyyy")#</td>
	  <td style="color:dark blue;"><a href="LogEntry.cfm?EID=#QSearchResult.issueID#"><img src="images/edit.png" alt="Edit Sub Issue" /></a>
	  <img src="images/view.png" alt="View Sub Issue" />
                 <cfif not val(previousParentIssueID)>
      <a href="AddChild.cfm?EID=#QSearchResult.issueID#"><img src="images/add.png" alt="Add Child" /></a>
      </cfif>
	  </td>
  </tr>
</cfif>
</cfoutput>

Open in new window



ad
0
 

Author Comment

by:lulu50
ID: 39953889
Could not have done it without you!!!!!!!!!!!!!!!!!!!

Thank you lol
0
 

Author Closing Comment

by:lulu50
ID: 39953891
Excellent+++++
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39953959
Super, glad it worked!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now