Your JavaScript control must include a few fundamentals, as follows.
Your control name should match that defined in your C++ component's WCCcontrol structure.
All JavaScript controls share an overall html structure. They comprise an outer frame element, and an inner client element.
Frame Element:
Has no content, other than the client element.
Contains the Omnis properties which pertain to the container of the control, e.g. its border.
Client Element:
Initially has its content set to that specified in the innerHTML() method of the C++ component.
Should contain the entire control structure.
You should only ever add child elements to the Client element (or its children), never to the Frame element.
Most methods of a JavaScript control are added to the object's prototype. This helps reduce memory usage when lots of instances of the control are present (as may be the case with a re-useable component such as you are creating).
The standard way that we create a JS control is by creating a constructor function for the control (generally at the bottom of the file), and then create an Immediately Invoked Function Expression (IIFE) which creates the prototype for the control.
The prototype must inherit from the ctrl_base class (the base class for all JavaScript controls). This can be achieved by setting the prototype of your new control to be initially equal to a new instance of ctrl_base, then you can extend it.
The following gives a brief example of the structure:
ctrl_mycontrol.prototype = (function() {
var ctrl = Object.create(ctrl_base.prototype); // The object which will become the prototype - inherited from the base class.
var myConst = 123; // A constant value
ctrl.publicMethod1 = function(p1) {
// public methods which are inherited from the base class, and called by the JS Client framework will have 'this' set to the control instance.
this.instVar = p1;
privateMethod1.call(this, "abc"); // Make sure to use call() to pass the appropriate value for 'this'.
};
function privateMethod1(p1) {
// Private method code.
}
return ctrl; // Return the prototype object.
})();
/**
* constructor for our control
* @constructor
*/
function ctrl_mycontrol()
{
this.init_class_inst(); // initialize our class
}
Your control must also implement the following methods:
Constructor
init_class_inst
init_ctrl_inst
You will probably want to implement more Control Methods than these, and there are several optional ones available.
The most-used of these are already provided as stubs in the generic.js file, included in the SDK, so this is always a good starting point from which you can extend the functionality of your own control.
In order for your control to work, you must tell the .htm page to load your .js file as a resource.
Alternatively, you may prefer to use your jsctempl.htm file from this same location, so whenever you generate a form's .htm file using Test Form, it will be created from this template.
Do the same for any custom CSS files you are using for your control. Add these after all other CSS files except user.css, but before the <script> tags.
With the introduction of theme colors to Studio 10.2 you can support these in your control.
When creating its innerHTML, your component should use the jsInsertColor() method to insert color properties for your control to use. This will insert the property value as an integer: either a Theme Color Constant or an explicit Omnis RGB Integer.
Example
jsInsertColor("data-mycolor", color, pInner); // inserts the value of color into the data-mycolor attribute in the controls HTML.
Your JavaScript control should then be able to read this in and store it as an integer to work with the Theme related methods.
Example
let myColor = +this.clientElem.getAttribute("data-mycolor"); // coerce the value of "data-mycolor" into an integer to store in myColor.
Color properties that are set at runtime will be received from the server as integers in your control's setProperty() method.
Default Colors
Default property colors are all handled client-side. Your control inherits the DefaultColors property, which is an object that is used to determine the color to apply to certain elements (usually when its associated property is set to kColorDefault).
Use this in conjunction with ctrl_base.DEFAULT_COLOR_NAMES (see Constants) to access the correct member. You can override the properties here to change the default colors of your control.
Example
this.DefaultColors[ctrl_base.DEFAULT_COLOR_NAMES.BACKGROUND] = Theme.COLORS.primary // sets the default background color of your control to the primary color.
You can extend this further to add custom default colors to your control. You should create a new object of color names and add the equivalent members the DefaultColors property.
You will then be able to use this further on in your code when setting elements' colors to ensure they have the correct color when the property relating to it is set to kColorDefault.
Example
// Set up default colors
const MY_COLOR_NAMES = {
MY_COLOR: "MY_COLOR" // custom color name
};
this.DefaultColors[MY_COLOR_NAMES.MY_COLOR] = Theme.COLORS.secondary; // assigns secondary color as the default color when referencing MY_COLOR
// Assigning a color
const theme = this.getTheme(); // gets the Theme object
const myElem = document.getElementById("myElement");
myElem.style.backgroundColor = theme.getColorString(value, this.DefaultColors[MY_COLOR_NAMES.MY_COLOR]); // sets the backgroundColor of myElem to a color/theme color specified by 'value' or, if 'value' is kColorDefault uses the value held in this.DefaultColors.MY_COLOR
Text Color Handling
There is special handling for text colors to attempt to use the right default text color on top of the background color set.
For example, if you have set the background color of an element to secondary color, then when setting the text color, if its property is set to kColorDefault, it will use secondary text color.
To do this you need to resolve the background color first (as it may be set to kColorDefault), and then pass this color into getTextColorString() as its 'onColor'. See also resolveDefaultColor().
Example
const theme = this.getTheme(); // gets the Theme object
const myElem = document.getElementById("myElement");
const resolvedBackColor = this.resolveDefaultColor(backColor, ctrl_base.DEFAULT_COLOR_NAMES.BACKGROUND); // resolves the background color stored in backColor, in case it is set to kColorDefault.
myElem.style.color = theme.getTextColorString(value, resolvedBackColor, Theme.COLORS.primaryText) // sets the text color of the elem to the value, unless it is kColorDefault, then attempts to find the text color to sit on top of resolvedDefaultColor, otherwise it uses the default color specified in the third parameter, primaryText in this case.
Constants used throughout the JavaScript client are generally defined as part of an enumerated type.
Following are the base enumerated types you may need to make use of.
eAnums |
Attribute numbers, used for ascertaining the context of method calls.
Values
priv = -1 (Special value for private method calls)
none = 0
$cfield = 89 (The current field - same as $cfield in Omnis)
$cinst = 77 (The current form instance - same as $cinst in Omnis)
$cwind = 66 (The current top-level form instance - same as $cwind in Omnis).
eBaseBorder |
Set of border style constants.
Values
None = 0
Plain = 1
Inset = 2
Embossed = 3
SingleInset = 9
SingleEmbossed = 10
Default = 100
eBaseEvent |
Standard events that are supported by the base class and that can be sent to the server.
Values
evNone = 0
evBefore = -3
evAfter = -4
evClick = -5
evDoubleClick = -6
evDrag = -13
evDrop = -18
evHidden = -40
evShown = -41
evTabSelected = -43
evWillDrop = -50
evCanDrop = -51
evCellChanged = -53
evOpenContextMenu = -58
evHeaderClick = -68
evExecuteContextMenu = -90
evHeadedListDisplayOrderChanged = -91
evUserChangedPane = -94
evFormToTop = -77
evDragFinished = -83
evScreenOrientationChanged = -89
evSubFormToTop = -92
evAnimationsComplete = -93
evDragBorder = -95
evLayoutChanged = -106
evWillShow = -111
evWillHide = -112
evSubformLoaded = -116
eBaseProperties |
The group of constants describing the base properties. They correspond to the Omnis properties of the same name.
Values
name = -1
ident = -25
count = -53
iconid = -250
tooltip = -262
hiliteline = -278
errortext = -363
title = -400
top = -401
left = -402
height = -403
width = -404
horzscroll = -409
vertscroll = -410
backcolor = -416
backpattern = -417
dragborder = -438
order = -440
dataname = -433
text = -444
visible = -446
uppercase = -453
negallowed = -454
zeroempty = -455
multipleselect = -463
forecolor = -464
font = -465
fontsize = -466
fontstyle = -467
align = -468
linestyle = -469
edgefloat = -470
container = -473
effect = -494
hscroll = -498
vscroll = -499
enabled = -506
dragmode = -508
dropmode = -509
active = -514
checked = -571
fontname = -690
bordercolor = -720
textcolor = -721
inputmask = -725
contextmenu = -760
fieldstyle = -887
vscrolltips = -905
events = -956
okkeyobject = -980
cancelkeyobject = -985
keepaspectratio = -987
userinfo = -1091
disabledefaultcontextmenu = -1117
disablesystemfocus = -1130
alpha = -1200
screensize = -1201
commandid = -1204
remotemenu = -1205
backalpha = -1227
beginanimations = -1232
commitanimations = -1233
vertcentertext = -1243
jsdateformat = -1250
jsdateformatcustom = -1251
borderradius = -1252
autoscroll = -1253
resizemode = -1255
jsnumberformat = -1256
cssclassname = -1257
sqlobject = -1265
errorline = -1303
errortextpos = -1305
textishtml = "$textishtml"
pagesize = -1307
visibleinbreakpoint = -1324
autocomplete = "$autocomplete"
autocapitalize = "$autocapitalize"
autocorrect = "$autocorrect"
preventlayoutanimation = -1341
arialabel = -1361
arialabelledby = -1362
ariadescribedby = -1363
ischeckable = -1365
keyboardchangesline = "$keyboardchangesline"
defaultdisabledappearance = -1369
pagerpage = -1377
sidepanel = -1416
sidepanelmode = -1417
hasshadow = -1431
nexttabobject = -1440
horzPadding = "$horzpadding"
vertPadding = "$vertpadding"
defaultinactiveappearance = -1463
removefromtaborder = -1466
datePickerOptions = "$datepickeroptions"
enterToDoubleClick = "$entertodoubleclick"
label = -1480
labeltextcolor = -1481
labelhottextcolor = -1482
labelfontsize = -1483
labelposition = -1484
labeliscontenttip = -1485
vertAlign = "$vertalign"
splitIconAndText = "$spliticonandtext"
iconTextSpacing = "$icontextspacing"
iconColor = -1502
reorderMode = "$reordermode"
eClientPlatforms |
enum of possible client platforms.
Values
Unknown = -1
Windows = 0
macOS = 1
Linux = 2
iOS = 3
eDateParts |
The group of date part constants used in omnis_date methods.
Values
kYear = 1
kMonth = 2
kWeek = 3
kDayOfYear = 4
kQuarter = 5
kMonthofQuarter = 6
kWeekofQuarter = 7
kDayofQuarter = 8
kWeekofMonth = 9
kDay = 10
kHour = 19
kMinute = 20
kSecond = 21
kCentiSecond = 22
eDoMethodFlags |
Set of flags which can be used when calling methods.
You should OR values together to set multiple flags. E.g. eDoMethodFlags.completionEvent | eDoMethodFlags.noOverlay.
Values
completionEvent = 1 (If set, the return value of a server method is to be passed to form (not field) client method <omnisMethodName_return> for the form)
clientOnly = 2 (If set, only a client method is to be called)
noOverlay = 4 (If not set, a user-interface protection overlay will be applied to the form, to prevent further interaction until the method returns)
noLog = 8 (If not set, and clientOnly is set, when running against an Omnis Design Server, a message will be logged to the console if a client method could not be called).
eOmnisDataSubTypes |
The group of values used to denote Omnis data subtypes.
Note that JavaScript is not strongly typed, so will not restrict data you enter to these types. If necessary, you should take care to ensure the data you enter matches these formats.
Values | |
---|---|
default = 0 | |
Integer Subtypes | intShort = 32 int32 = 0 int64 = 64 |
Number Subtypes | numberShort = 32 numberRealDps = 31 (Logical & this with the required number of dps. E.g. eOmnisDataSubTypes.numberRealDps & 4 ) |
Character Subtypes | characterSimple = 0 characterNational = 1 |
Date Subtypes | date1900 = 0 date1980 = 1 date2000 = 2 dateTime1900 = 3 dateTime1980 = 4 dateTime2000 = 5 time = 6 dateTimeC = 7 (date time including a century) timestamp = 1000 (full date time stamp) Values 1001-1030 can also be passed as an index into the date formats defined in #DFORMS. |
List Subtypes | listRow = 1 (If used with a type of fftList, the type will become row) |
eOmnisDataTypes |
The group of constants describing the various Omnis data types.
Values
fftNone = 20
fftCharacter = 21
fftBoolean = 22
fftDate = 23
fftSequence = 24
fftNumber = 25
fftInteger = 26
fftPicture = 27
fftBinary = 28
fftList = 29
fftRdef = 30
fftCrb = 31
fftFieldname = 32
fftItemRef = 33
fftCalc = 34
fftConstant = 35
fftRow = 36
fftObject = 37
fftObjref = 38
ctrl_base.DEFAULT_COLOR_NAMES |
Set of keys to be used with the controls DefaultColors member.
Values
BACKGROUND = "background" (The key within this.DefaultColors referencing the default background color)
TEXT = "text" (The key within this.DefaultColors the referencing default text color)
BORDER = "border" (The key within this.DefaultColors referencing the default border color)
SYSTEM_FOCUS = "SYSTEM_FOCUS" (The key within this.DefaultColors referencing the default system focus color)
Areas of the JavaScript client allow you to specify formatting strings to determine how Date/time data should be displayed.
A date format string can make use of any of the following control characters:
a - am/pm
A - AM/PM
s - Hundredths of a second. E.g. "007"
S - Seconds (0-59)
N - Minutes (0-59)
V - Short day of week name. e.g. "Fri"
w - Full day of week name. e.g. "Friday"
D - The day of the month, as 2 digits. e.g: "02".
j - Day of month with no leading zero. e.g. "2".
d - The ordinal day of the month. e.g "12th".
E - The day of the year (1 - 366).
H - Hour with leading 0 (0 - 23).
h - Hour with no leading 0 (1 - 12).
K - hour with no leading zero (0..23)
k - hour with leading zero (01..12)
M - Month of year, with leading 0. e.g. "06".
P - Month of year, with no leading zero. e.g. "6"
m - Short month name. e.g. "JUN".
n - Full month name. e.g. "June"
Y - Year as 2 digits. e.g. "14"
y - Full year. e.g. "2014"
O - Timezone offset (+01:00)
Other characters will appear as-is.
E.g. "D/M/y H:N:S.s a" would display like:
"26/09/2014 17:30:05.012 pm"
DEPRECATED in 10.2
Color Pairs are no longer needed (all browsers now support alpha), and they do not support Themed Colors. You should instead use RGB Integers or color constant values.
A Color Pair is a string defining a solid color and a color with alpha support.
Functionality within the JavaScript client makes use of these Color Pairs in order to support browsers which do not support RGBA colors.
The string must be formatted as the solid color, followed by the alpha color, separated by a semi colon:
"<solid color>;<alpha color>"
The solid color can have either the "#RRGGBB" format, or "rgb(r,g,b)" format.
The alpha color must have the "rgba(r,g,b,a)" format.
Omnis RGB Integers are the standard way to represent colors in the JS Client.
They describe a color, with no alpha component. They are therefore 3 byte unsigned integers, and so have a maximum value of 16777215.
They are similar to a standard decimal color, but with the byte order reversed.
Therefore, reading the byte order from left to right.
The first byte is the blue component.
The second byte is the green component.
The third byte is the red component.
RGB Integers with a negative value indicate that it represents a color constant, such as a themed color.
You can convert a CSS color string to an Omnis RGB Integer using the jOmnis.rgbFromCssColor() method.
Similarly, you can convert an Omnis RGB Integer to a CSS color string using <theme>.getColorString() (or <theme>.getTextColorString() if it's intended for use as a text color).
Areas of the JavaScript client allow you to specify formatting strings to determine how numeric data should be displayed.
See the Number Formatting section of the Creating Web & Mobile Apps document (under "JavaScript Component Properties").
An omnis_cols is an object which represents a list's columns group (equivalent to $cols).
omnis_cols(pList) |
Constructor for an omnis_cols object.
Parameters:
Returns:
Example
var myCols = new omnis_cols(myList.getListdata());
$add(pName, pType, pSubType, pLen) |
Adds a new column onto the end of the list's columns.
Parameters:
pName (String): The column name.
pType (Integer): The column type. One of the eOmnisDataTypes values.
pSubType (Integer): The column subtype. One of the eOmnisDataSubTypes values.
pLen (Integer): The length of the column data type. E.g. character limit.
Alternatively, you can instead just pass an array, the first element of which is the name of an Omnis Instance variable, and the column will be defined from the instance variable's definition.
Returns:
Example
var newCol = myCols.$add("Age", eOmnisDataTypes.fftInteger, eOmnisDataSubTypes.intShort, 0);
$count() |
Returns the number of columns.
Parameters:
Returns:
Example
var colCount = myCols.$count();
getCanAssign(pColumn, pPropNumber) |
Returns whether the specified property can be changed for the specified column.
Parameters:
pColumn (String or Integer): The column name or number (optionally prefixed with "C").
pPropNumber (Integer): The property number to query.
Returns:
Example
var canAssign = myCols.getCanAssign("Quantity", eBaseProperties.name); // checks whether we can change the name of the Quantity column.
getProperty(pColumn, pPropNumber) |
Gets a property from a column.
Parameters:
pColumn (String or Integer): The column name or number (optionally prefixed with "C").
pPropNumber (Integer): The property to query. One of:
eListProperties.coltype
eListProperties.colsubtype
eListProperties.colsublen
eBaseProperties.ident
eBaseProperties.name
Returns:
Example
var colName = myCols.getProperty(3, eBaseProperties.name); // Get column 3's name
getValue(pName) |
Gets a column by name or column number.
Parameters:
Returns:
Example
var col3 = myCols.getValue(3);
setPropCli(pColumn, pPropNumber, pPropValue) |
Sets a property of a column to the specified value.
Parameters:
pColumn (String or Integer): The column name or number (optionally prefixed with "C").
pPropNumber (Integer): The property to set. One of:
eListProperties.coltype
eListProperties.colsubtype
eListProperties.colsublen
eBaseProperties.name
pPropValue (Var): The new value to set the property to.
Returns:
Example
var success = myCols.setPropCli("Quantity", eBaseProperties.name, "Amount"); // Rename the Quantities column to "Amount".
$addafter(pAfterCol, pName, pType, pSubType, pLen) |
Adds a new column after the specified column.
Parameters:
pAfterCol (Integer or Object): The column number, or column object instance, to insert the new column after.
pName (String): The column name.
pType (Integer): The column type. One of the eOmnisDataTypes values.
pSubType (Integer): The column subtype. One of the eOmnisDataSubTypes values.
pLen (Integer): The length of the column data type. E.g. character limit.
Alternatively, you can instead just pass an array, followed by pAfterCol. The second element of the array should be the name of an Omnis Instance variable, and the column will be defined from the instance variable's definition.
Returns:
Example
var newCol = myCols.$addafter(2, "NewCol", eOmnisDataTypes.fftCharacter, eOmnisDataSubTypes.characterSimple, 1000); // Add "NewCol" as column 3.
// Or...
var newCol = myCols.$addafter(["","iVar1"],2); // Add column defined from instance variable iVar1 as column 3
$addbefore(pBeforeCol, pName, pType, pSubType, pLen) |
Adds a new column before the specified column.
Parameters:
pBeforeCol (Integer or Object): The column number, or column object instance, to insert the new column before.
pName (String): The column name.
pType (Integer): The column type. One of the eOmnisDataTypes values.
pSubType (Integer): The column subtype. One of the eOmnisDataSubTypes values.
pLen (Integer): The length of the column data type. E.g. character limit.
Returns:
Example
var newCol = myCols.$addbefore(2, "NewCol", eOmnisDataTypes.fftCharacter, eOmnisDataSubTypes.characterSimple, 1000); // Add "NewCol" as column 1.
// Or...
var newCol = myCols.$addbefore(["","iVar1"],2); // Add column defined from instance variable iVar1 as column 31
$remove(pCol) |
Removes a column from the list.
Parameters:
Returns:
Example
mCols.$remove(3); // Remove column 3 from the list.
This object represents an Omnis Date, and provides various methods for date operations.
An omnis_date instance has the following properties:
dtY – Year
dtM – Month
dtD – Day
dtH – Hour
dtN – Minutes
dtS – Seconds
dtG - Milliseconds
omnis_date(pValue) |
Constructor. Creates a new omnis_date object.
Parameters:
Returns:
Example
var rightNow = new omnis_date(null);
equals(pOmnisDate) |
Compares this omnis_date instance to another.
Parameters:
Returns:
Example
var identical = myDate.equals(myOtherDate);
toJavaScriptDate() |
Returns the date specified by the omnis_date instance as a standard JavaScript Date object
Parameters:
Returns:
Example
var jsDate = myDate.toJavaScriptDate();
getHasTime(pOmnisDate) Static function |
Returns whether the passed omnis_date instance has a time component.
This is a static function, and does not require an omnis_date instance to call it.
Parameters:
Returns:
Example
var myDate = new omnis_date(null);
omnis_date.getHasTime(myDate);
add(pPart, pAmount) |
Adds pAmount units to the date's component specified by pPart.
Does not modify the original omnis_date, but returns a new instance with the modifications.
Parameters:
pPart (Integer): The date component to add to. One of the eDateParts constants.
pAmount (Integer): The number of units to increase the date component by. (Use negative values to decrease).
Returns:
Example
var myDate = new omnis_date(null);
myDate = myDate.add(eDateParts.kDay, 10); // Add 10 days to myDate
getFormat() |
Gets the format string for this date, based on its subtype (subtype only applies if it's an Omnis instance variable).
Parameters:
Returns:
Example
var fmtString = myDate.getFormat();
The omnis_list is the client-side representation of an Omnis list or row variable.
omnis_list(pOmnisList) |
Constructor for an omnis_list object.
Parameters:
Returns:
Example:
var myList = new omnis_list(null);
var myListCopy = new omnis_list(myList.getListData());
getChar(pCol, pRowNumber, pZeroEmpty) |
Returns character data for the specified column and row.
Parameters:
pCol (String or Integer): Can be either the column name, or the column number (1-indexed).
pRowNumber (Integer): The row number (1-indexed). If zero, the current line will be used.
pZeroEmpty (Boolean): If true, zero values are returned as an empty string.
Returns:
Example:
var qntString = myList.getChar("quantity", 2, true);
getData(pCol, pRowNumber) |
Returns the data in the cell specified by the column and row.
Parameters:
pCol (String or Integer): Can be either the column name, or the column number (1-indexed).
pRowNumber (Integer): The row number (1-indexed). If zero, the current line will be used.
Returns:
Example:
var name = myList.getData("Name", 2);
setData(pCol, pRowNumber, pNewData) |
Sets the data in the specified row and column.
Parameters:
pCol (String or Integer): Can be either the column name, or the column number (1-indexed).
pRowNumber (Integer): The row number (1-indexed). If empty or zero, the current line will be used.
pNewData(Var): The new data to apply to the cell.
Returns:
Example:
var success = myList.setData("Name", 2, "Bert");
search(pCol, pSearchValue, pSetCurrentRow, pSelectMatches, pDeSelectNonMatches) |
Searches a column in the list and returns the first matching row.
Parameters:
pCol (String or Integer): Can be either the column name, or the column number (1-indexed).
pSearchValue (Var): The value to search for.
pSetCurrentRow (Boolean): Whether the list's current row should be set to the returned row.
pSelectMatches (Boolean): If true, all matching rows are selected.
pDeselectNonMatches (Boolean): If true, all non-matching rows are de-selected.
Returns:
Example:
var bertsRowNum = myList.search("Name", "Bert", false, false, false);
getRowSelectionState(pRowNumber) |
Gets the selection state for the specified row.
Parameters:
Returns:
Example:
var isSelected = myList.getRowSelectionState(3);
setRowSelectionState(pRowNumber, pNewSelectionState) |
Sets the selection state for the specified row.
Parameters:
pRowNumber (Integer): The row number (1-indexed). If zero, the current line will be used.
pNewSelectionState (Integer): The new selection state. (1=selected, 0=not selected)
Returns:
Example:
var success = myList.setRowSelectionState(3, 1); // Select row 3
setRowSelectionStateAllRows(pNewSelectionState) |
Sets the selection state for all rows in a list.
Parameters:
Returns:
Example:
myList.setRowSelectionStateAllRows(0); // De-select all rows
getCurrentRow() |
Returns the current row number for the list.
Parameters:
Returns:
Example:
var curLine = myList.getCurrentRow();
setCurrentRow(pNewCurrentRow) |
Sets the current line in the list.
Parameters:
Returns:
Example:
var success = myList.setCurrentRow(3);
getRowCount() |
Gets the number of rows in the list.
Parameters:
Returns:
Example:
var rowCount = myList.getRowCount();
getColumnCount() |
Gets the number of columns in the list.
Parameters:
Returns:
Example:
var colCount = myList.getColumnCount();
addRow(pBeforeRowNumber, pColumnCount) |
Adds an empty row to the list.
Note that you can only add a row to a list (not a row).
Parameters:
pBeforeRowNumber (Integer): The row number the new row will be inserted before. If 0, it will be added to the end of the list.
pColumnCount (Integer): The initial number of columns for the new row.
Returns:
Example:
var newRowNum = myList.addRow(3,2);
deleteRows(pActionOrRow) |
Deletes the specified rows from the list.
Parameters:
Returns:
Example:
var deletedCount = myList.deleteRows(eListDeleteRow.Selected); // Delete all selected rows.
findColumn(pCol, pBeginsWith) |
Gets the specified column's column number in the list or row.
Parameters:
pCol (String or Integer): One of:
The column number.
The column name.
The column number, prefixed by "C". E.g. "C4".
pBeginsWith (Boolean): If true, it will return the first column whose name begins with the string passed in pCol. Defaults to false.
Returns:
Example:
var nameCol = myList.findColumn("Name", false);
getRowArray(pRowNumber) |
Returns a row's data as an array. Each element of the array being a column of the row.
Parameters:
Returns:
Example:
var myData = myList.getRowArray(3);
var colTwoValue = myData[1];
getListData() |
Returns the raw list data (an omnis_raw_list object), from the list. This is needed to pass into many of the row/col methods.
Parameters:
Returns:
Example
var rawList = myList.getListData();
This object represents a single column in a list.
Most column actions are performed using the omnis_cols object. However, the omnis_cols methods often involve passing instances of this object around.
var myCols = new omnis_cols(myList.getListData());
var myCol = myCols.getValue(3); // Get the third column in the list.
$clear() |
Clears all values in this column.
Parameters:
Returns:
Example
var success = myCol.$clear();
$count(pSelOnly) |
Returns the number of (optionally selected) rows in the column.
Parameters:
Returns:
Example
int selectedRows = myCol.$count(true);
$removeduplicates(pSortNow, pIgnoreCase) |
Removes any rows which have duplicate values in this column.
Duplicates are removed from the bottom up.
Parameters:
pSortNow (Optional) (Boolean): If true, the list will be sorted by this column before duplicates are removed. Defaults to false.
pIgnoreCase (Optional) (Boolean): If true, checks for duplicity will ignore case. Defaults to false.
Returns:
Example
var removedLines = myCol.$removeduplicates(true, true);
The omnis_raw_list object is a component of the omnis_list object.
The omnis_raw_list functions are not exposed as part of this API, as you should use the higher-level methods available from the omnis_list object.
The omnis_list wrapper of an omnis_raw_list can be obtained from the omnis_raw_list's __list property.