Solved

the pagesize argument passed to the myposts function is not of type Coldfusion Ajax

Posted on 2008-10-30
5
313 Views
Last Modified: 2014-05-22
Hai experts

I'm getting this error

the pagesize argument passed to the myposts function is not of type
numeric

following my code

--employer.cfc--

<cffunction name="myposts"
 hint="My Posts" returntype="any" access="remote">
 <cfargument name="mysession" type="string" required="yes">
 <cfargument name="page" type="numeric" required="yes" default="1">
 <cfargument name="pageSize" type="numeric" required="yes" default="40">
 <cfargument name="gridsortcolumn" type="string" required="no" default="">
 <cfargument name="gridsortdirection" type="string" required="no" default="">
 <cfset var myposts="">


 <cfquery name="myposts" datasource="nizar">
select a.job_id,a.job_name,b.job_category_name,c.country_name,
a.job_role,a.job_requirements
from job_posts a,job_category b,countries c
where a.JOB_CATEGORY_ID=b.JOB_CATEGORY_ID
and a.COUNTRY_ID=c.COUNTRY_ID
and a.user_id='#arguments.mysession#'
order by created_date desc
 </cfquery>
 
<cfreturn QueryConvertForGrid(myposts,arguments.page,arguments.pageSize)>
 
 </cffunction>
 
--employer_posts.cfm--

<cfinvoke
 component="Employers.employer"
 method="myposts"
 returnvariable="myposts">
      <cfinvokeargument name="mysession" value="#session.user_id#"/>
</cfinvoke>

  <cfform>
  <cfgrid name="getlist" format="html" bind="cfc:Employers.employer.myposts({cfgridpage}, {cfgridpagesize}, {cfgridsortcolumn}, {cfgridsortdirection})">
  <cfgridcolumn name="job_id" header="Job ID" width="100"/>
  <cfgridcolumn name="Job_name" header="Job Name" width="100"/>
  <cfgridcolumn name="job_category_name" header="Job Category" width="100"/>
  <cfgridcolumn name="country_name" header="Country" width="100"/>


  </cfgrid>
  </cfform>
       
       


0
Comment
Question by:faizershez
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
azadisaryev earned 500 total points
ID: 22840018
your myposts function requires 3 arguments: mySession, page & pageSize (they are set with required="yes" attribute, so you MUST pass these arguments to the function). but in your <cfinvoke> you are passing only ONE argument to it.

DEFAULT attribute of <cfargument> tag has no effect when an argument is set as required

but the bigger question is: why do you need that <cfinvoke> there at all???
0
 
LVL 1

Expert Comment

by:coderWil
ID: 22843098
Your CFINVOKE is passing a the pagesort value to the pagesize value.

since 3 of your function arguments are required, you need to pass them 'in the order they are declared' to the function.

Hope this helps.
0
 
LVL 27

Assisted Solution

by:azadisaryev
azadisaryev earned 500 total points
ID: 22843170
change your cfgrid's bind attribute to:

bind="cfc:Employers.employer.myposts(session.user_id, {cfgridpage}, {cfgridpagesize}, {cfgridsortcolumn}, {cfgridsortdirection})"

and get rid of your <cfinvoke>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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