a5_ux_action Function

Syntax

C a5_UX_Action(P e ,P ops [,C actionType ])

Arguments

e

Pointer

ops

Pointer

actionType

Character

Description

Perform an action on the UX during an ajax callback. actionType is: 'ajaxListAction' (default), 'populateControlsFromTable'

Summary of Actions that Can Be Performed

The a5_ux_action() Xbasic function is a utility function that can be used in an Ajax callback to generate the Javascript commands to perform certain actions on a UX component. The purpose of this command is to allow you to consolidate several actions that would normally be performed by distinct Ajax callbacks into a single Ajax callback. The actions that can be performed by this utility function are:

  • List Control Action

  • Filter List

  • Refresh List

  • Refresh row(s) by key value

  • Append row(s) by key value

  • Refresh Data Series

  • Set UX into 'New Record' mode

  • Populate Controls with Data from a Table

  • Refresh choices in a dropdownbox control

List Control Action: Filter List

Filters/sorts the data in a List control. This action is equivalent to the {dialog.object}.filterList() method. Example:

Function myAjaxCallback as c (e as p)

    dim ops as p
    ops.Action = "Filter"
    ops.filter = "country = :country and city = :city"
    ops.order = "companyname desc"

    'the arguments are specified in a crlf() delimited string. 
    'syntax is argumentValue|||type|argumentName
    ops.parameters = "UK|||c|country" + crlf() + "London|||c|city"

    'specify the id of the list to filter
    ops.listId = "list1"

    dim xb as c
    xb = a5_UX_Action(e,ops,"ajaxListAction")

    myAjaxCallback = xb 

end function

List Control Action: Refresh List

Refreshes the data in a List control. This action is equivalent to the {dialog.object}.refreshListData() method. You can refresh multiple Lists with a single Ajax callback using a checkbox list. Older versions used a combo box to set the List Ids to refresh. Example:

Function myAjaxCallback as c (e as p)
    dim ops as p
    ops.Action = "Refresh"
    ops.listId = "list1"
    dim xb as c
    xb = a5_UX_Action(e,ops,"ajaxListAction")
    myAjaxCallback  = xb 
end function

List Control Action: Refresh Row(s) by key value

Refreshes data in one or more rows of a List control. This action is equivalent to the {dialog.object}._listRefreshRecordsByKey() method. Example:

Function myAjaxCallback as c (e as p)
    dim ops as p
    'primary keys to refresh (case sensitive!)
    ops.primaryKey = "EASTC,GALED,FURIB"
    ops.listId = "list1"
    ops.action = "refreshRowByKey"

    'if the record to be refreshed is not currently in the list, 
    'should it be added to to the list?
    ops.appendRowsNotInList = .f.

    dim xb as c
    xb = a5_UX_Action(e,ops,"ajaxListAction")
    myAjaxCallback = xb
end function