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

UPDATE: cfdiv binding to cfc not displaying multiple results

New Here ,
Jun 09, 2009 Jun 09, 2009

Sorry guys, it appears that my code was not posted correctly on my original post and therefore did not show up.

Please see below for my question/problem. - Thanks!

---------------------------

Hey guys,

Something strange is going on. I am using CF8 and I have multiple records in a table and they all display fine with a table within a cfoutput query="foo". However I want to use cfdiv instead to take advantage of partial page updates.

So I am binding my cfdiv to a cfc and when it runs it only displays the first record. I have had similar problems with using cfoutput query and divs in the past. Is there something about divs that don't allow multiple results to display?

Here is my code:

<cfinvoke component="services.PostService" method="getPosts" returnvariable="post">

<cfinvokeargument name="numberOfRows" value="4">

</cfinvoke>

<cfoutput>

<cfdiv bind="cfc:services.PostService.getPosts(4)">

#post.description# <br />

</cfdiv>

</cfoutput>

Here is my component in case you need to look at it:

<cfcomponent output="no">

<cffunction name="getPosts" access="remote">

<cfargument name="numberOfRows" type="numeric" required="yes">

<cfset var getPosts = "">

        <cfinclude template="../dal/qry_getPosts.cfm">

<cfreturn getPosts>

</cffunction>

</cfcomponent>

Thanks for any help you can provide.

Thank you,

Chris

1.1K
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

correct answers 1 Correct answer

Participant , Jun 11, 2009 Jun 11, 2009

Well here is what I see.

You don't need to invoke the cfc at the start as your bind statement is invoking it for you and you dont need the #post.description# within the cfdiv.

so you end up with

<cfdiv bind="cfc:services.PostService.getPosts(4)"></cfdiv>

second what ever is returned by the cfc function will be displayed within the cfdiv. So returning a query isnt going to work here you need to have your function process the query and return the actual html you want to display.

Hope this helps.

Richar

...
Translate
Participant ,
Jun 11, 2009 Jun 11, 2009

Well here is what I see.

You don't need to invoke the cfc at the start as your bind statement is invoking it for you and you dont need the #post.description# within the cfdiv.

so you end up with

<cfdiv bind="cfc:services.PostService.getPosts(4)"></cfdiv>

second what ever is returned by the cfc function will be displayed within the cfdiv. So returning a query isnt going to work here you need to have your function process the query and return the actual html you want to display.

Hope this helps.

Richard

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
New Here ,
Jun 15, 2009 Jun 15, 2009
LATEST

Thanks for your help man! I really appreciate 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
Resources