Rows.mark()
This article is about the mark() function of the Rows object.
Rows.mark()
Gets or sets the mark value of the rows in scope. Marking a record is a purely client-side bookkeeping aid; it has no effect on selection or the server.
Returns the mark value (a boolean) of the first row in the Rows object if value is omitted. Returns the this object if value is specified.
Marked records can be displayed visually by adding a MarkRecordControl to the GridControl. This will add a checkbox which denotes if the record is marked or not.
Marked records also created a special selection of rows that can be referred to with a row selector:
$.udb( *ds* ).rowSet( *rowSet* ).rows('marked')
Syntax
$.udb( *ds* ).rows( [rowRef1], [rowRef2] ).mark( [value] )
$.udb( *ds* ).rowSet( *rowSet* ).rows( [rowRef1], [rowRef2] ).mark( [value] )
*value* ::= { true | false | 'toggle' }
The required ds parameter is a data source selector.
The optional rowSet parameter is a rowset identifier. If the .rowSet() clause is omitted, then .rowSet('current') is assumed.
The optional rowRef1, rowRef2 are row selectors. If omitted, all records in scope are addressed.
- Omit value if you want to check whether the first record in the Rows object is marked or not (Example 1).
- Specify value if you want to change the mark value of one or more records (Example 2).
If specified, value has the following meaning:
| Value | Meaning |
|---|---|
true | Marks all records in scope |
false | Unmarks all records in scope |
'toggle' | Toggles the mark value of all records in scope |
Example 1
This example assigns the mark value (true or false) of the current record to the marked variable:
let marked = $.udb('EMP').rows('current').mark();
Example 2
These examples change the mark value of one or more records:
$.udb('EMP').rows().mark(true); // Mark all queried records
$.udb('EMP').rows(5).mark(false); // Unmark the 6th record