The first function I'll add is the execute Action() function.
Remember that since is a loosely typed language, I can add any method to any object, and as long as that method exists at runtime, it can be called by code that depends on a method with that name.
This will not violate "undef: true" or "use strict" since we indicated we wanted to use the BBUI global variable via "/*global BBUI, Ext, $ */". Action Utility in this sample; but, we will use the BBUI.forms. constructors is the assigning of the host object to "this." When defining a constructor, "this" refers to the object that we are currently working with, and in this case, the object we are working with is the Choose Correct Food Bank Constituent Page Action object., we use a constructor function to define our object, such as Choose Correct Food Bank Constituent Page Action.
Then we can utilize the prototype property of the constructor function to extend the constructor function by adding functions and properties at runtime.
Below is a simple example of test execute Action() function that takes an argument called "callback." Because the assumes you might perform some potentially long-running process like fetching data from the database, the function is called asynchronously with a callback function as its argument that should be called when the action is done executing.In the example below, I simply show an alert and immediately call the callback function.'s prototype, lets continue building our food bank custom action.can enhance UIModel-based data forms and other features. Create a Namespace Next you need to ensure the namespace where you'll create your custom action object exists.Java Script Starters Guide explains how encapsulation, polymorphism, and inheritance, the three tenets of object-oriented programming, are accomplished in referenced by the Food Bank Package Spec (Food Bank. This loads the prerequisite, tables, data forms, data lists, pages, etc. This example also assumes you used the Add Food Bank task to add a few food bank records into the The custom action can pivot to either the Food Bank page (shown here) or the Constituent page On the other hand, if we select "East Cooper Fire Department," which is not a food bank, the custom action directs us to the familiar file (in my case, I named the file "Choose Correct Food Bank Constituent Page Action.js" and placed it in the htmlforms\custom\blackbaud.customfx.foodbank folder within in my UI model project), you are ready to code. Because you add your object to an already-global object (namely the BBUI object), it is very important that you choose a unique name. UIModel project, your action's namespace would be "BBUI.customactions.foodbank." Note that namespace components after the "BBUI" component should be all lower-case, not camel-case or proper-case.
Open and review the The next piece of code to review is the declaration of variables within the self-invoking function. To ensure that you don't stomp on existing BBUI objects, the namespace "BBUI.customactions" is reserved for custom actions. Ensuring the existence of a namespace can be accomplished by calling the BBUI.ns() function along with the namespace's name.Note the usage of the BBUI global variable to help set the value of Action Util. All custom actions should be added to the BBUI.customactions" namespace. If the namespace exists, the function does nothing; if it doesn't exist, the function creates it.