Add count of related child records to DataTable?

Add count of related child records to DataTable?

lgoolsbylgoolsby Posts: 3Questions: 0Answers: 0
edited November 2010 in General
I have my DataTables working perfectly using Server Side Processing to display a list of HelpDesk tickets in my application. I now need to add a column (or to an existing column) a count of comments for each ticket. Basically I want each row (HelpDesk Ticket) to somewhere say "Comments: 3 (or what ever the count is.) I am having trouble with this.

I tried altering the Server-Side scripts $sQuery to include a column such as (Select count(id) FROM helpdesk_comments WHERE ticket_id = helpdesk.id) as cmntcount

Running such a query in MySQL works perfectly but I get a DataTable error when using it. Can somebody recommend an appropriate method to do this? I don't care when or how this comment count gets added to my records so long as it gets added.

As a side note, once I get the count added, my users then need to be capable of clicking or hovering over the count and have a UI_DIALOG or something query and display the comments. Any suggestions for that would be greatly appreciated as well.

Sincerely,

Lee Goolsby

Replies

  • lgoolsbylgoolsby Posts: 3Questions: 0Answers: 0
    OK, the problem with the count was a crazy mistake by me and it works perfectly using the nested SELECT as a column. Now I need to provide some method of the user viewing those comments when they hover or click on the count for any given row. Any help?
  • lgoolsbylgoolsby Posts: 3Questions: 0Answers: 0
    Opted to use the overlibmws popup library for this since I was using elsewhere on my sight. This allows me to have the user hover over my column and have a "popup" appear with comments pulled via AJAX. Works like a charm!

    Thanks for this great DataTables!!!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    HI lgoolsby,

    Sorry you've been having a bit of a monologue there - but good to hear you've got it sorted out. Have you got a link you can share with us - sounds quite nice!

    Allan
This discussion has been closed.