Alpha Video Training
Results 1 to 6 of 6

Thread: AJAX CallBack in grid (Rookie question)

  1. #1
    Member
    Real Name
    Ivan Lozano
    Join Date
    Apr 2013
    Location
    Azusa, CA. LA County
    Posts
    400

    Default AJAX CallBack in grid (Rookie question)

    Hello, I have a grid component that i would like to add an xbasic function to. There is a button in the grid list that performs the call back. I have declared my xbasic function but I am having trouble adding column value to one of my arguments. I know in a dialog component I would use for example "e.dataSubmitted.PK_MAIN_ID" to get a pointer for the value I would like to set the arg to, what is the equivalent for a grid?

    Ive tried using "args.set("arg1",e.rowData.data("PK_MAIN_ID"))" but I get an error that states "Property not found e.rowData subelement not found"

    Im sure the answer is simple but i just cant see it right now, Please help, thank you.

  2. #2
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,841

    Default Re: AJAX CallBack in grid (Rookie question)

    This is what I'm using in my grid xbasic: args.set("Some_Arg_Name",e._currentRowDataNew.My_Control_Here)

    Try this...

    Code:
    args.set("arg1",e._currentRowDataNew.PK_MAIN_ID)
    By the way: The argument can be named anything. It doesn't have to be "arg1". Just FYI.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  3. #3
    Member
    Real Name
    Ivan Lozano
    Join Date
    Apr 2013
    Location
    Azusa, CA. LA County
    Posts
    400

    Default Re: AJAX CallBack in grid (Rookie question)

    Thanks for the reply Mike, but I still get the same error Property not found e._currentRowDataNew.PK_MAIN_ID subelement not found

    Code:
    'MARK LTS STUDENT to look-up Table
    function MarkStudent as c (e as p)
    	debug(1)
    	dim cn as sql::Connection
    	dim args as sql::Arguments
    	dim sqlINSERT as c
    		
    	args.set("arg1", e._currentRowDataNew.PK_MAIN_ID)
    	args.set("arg2", "MAIN")
    	args.set("arg3", a5ws_getcurrentuser())
    			
    	flag = cn.open("::Name::JAC")
    		If flag = .f. then
    			MarkStudent = "alert('Could Not Establish Connection');"
    		else
    			sqlINSERT = "INSERT INTO marked (RECORD_ID, TABLE_NAME, STAFF_NAME) VALUES (:arg1, :arg2, :arg3)"
    			flag = cn.Execute(sqlINSERT, args)
    				If flag = .f. then
    					MarkStudent = "alert('Oops! Record Could Not Be Marked! " + js_escape(cn.CallResult.text) + "');"
    				else
    					MarkStudent = "alert('Record was Marked.');"
    				end if
    		end if
    	cn.Close()
    
    end function

  4. #4
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,115

    Default Re: AJAX CallBack in grid (Rookie question)

    is this during an insert of a new record?
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  5. #5
    Member
    Real Name
    Ivan Lozano
    Join Date
    Apr 2013
    Location
    Azusa, CA. LA County
    Posts
    400

    Default Re: AJAX CallBack in grid (Rookie question)

    No, this grid shows students (read-only). My users need to isolate specific students, what I was creating is a search grid to find students, then using a button in the grid to do an ajax callback to insert values into a separate table.

    *Essentially, I am trying to "mark" students the way the native alpha dbf tables allow for desktop.

    This works as i expect in a ux component, but I want this function to work in the grid so the user does not need to open a ux component in order to "mark" a student.
    Last edited by Gustavo1478; 04-28-2016 at 02:11 PM.

  6. #6
    Member
    Real Name
    Ivan Lozano
    Join Date
    Apr 2013
    Location
    Azusa, CA. LA County
    Posts
    400

    Default Re: AJAX CallBack in grid (Rookie question)

    I found the answer in this thread http://www.alphasoftware.com/alphafo...ment-not-found

    Post #6 by Sarah has fixed my problem. Thank you all for your inputs.

Similar Threads

  1. Refresh Grid after Ajax callback
    By gkpurcey in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 05-16-2013, 11:02 PM
  2. In a grid's button click, how do i run ajax callback then run report then callback?
    By WindForce in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 08-09-2012, 07:19 PM
  3. Grid Ajax Callback - Walking through all rows of a submitted grid example.
    By dionmccormick in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 08-02-2012, 12:24 PM
  4. AJAX Callback question
    By Mike Reed in forum Application Server Version 9 - Web/Browser Applications
    Replies: 3
    Last Post: 04-27-2009, 10:14 AM
  5. AJAX Callback syntax question
    By Steve Wood in forum Application Server Version 9 - Web/Browser Applications
    Replies: 7
    Last Post: 02-25-2009, 05:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •