Returns an array of key field values for all the selected records.
Note: The selected records are the ones that have the checkbox next to them selected.
Syntax
getSelectedRecordKeys();
Arguments
No arguments
Return value
The return value is an array of arrays even if there is only one key field in the table.
Note: The key field values obtained this way can be used as is in the selection parameter of Runner.PDF.open or Runner.PDF.download functions.
Output
[ [1], [2], [10] ]
Example
You may need to clean all the Details table records corresponding to one of the Master table record.
For this purpose, you can insert a Custom button into the Master table List page.
Client before:
params["keys"] = pageObj.getSelectedRecordKeys();
Server:
foreach (KeyValuePair<XVar, dynamic> key in parameters["keys"].GetEnumerator())
{
DB.Exec((XVar)(MVCFunctions.Concat("delete from carsmodels where make=", key.Value["id"])));
}
Note: In this example, carsmodels is a Details table name; make is the name of the Master-details link field.
Client after:
location.reload();
See also:
•JavaScript API: RunnerPage object > getSelectedRecords()
•JavaScript API: RunnerPage object > getAllRecords()
•Grid Row JavaScript API: row.getKeys()
•Button object: getNextSelectedRecord()
•How to create PDF from all selected records except the first one
•JavaScript API: RunnerPage object