foundset.setSelectedIndex(foundset.getSelectedIndex()+1) // goes forward
foundset.setSelectedIndex(foundset.getSelectedIndex()-1) // goes backward
itgenetics wrote:I guess that these should be global methods? As I will use them throughout my solution.
/**
* Va a Primer Registro
*
* @param {JSEvent} event the event that triggered the action
* @properties={typeid:24,uuid:"08DC7FAE-6125-41C7-8DEA-C7A862E4E657"}
*/
function goFirstRecord(event) {
var frm = currentcontroller.getName();
if(forms[frm].frmIsEditing){
// If the form is editing a record we ask what to do
globals.askForSaving(frm);
}
if(!forms[frm].frmIsEditing){
var _foundset=forms[frm].foundset
_foundset.loadAllRecords();
_foundset.setSelectedIndex(1)
}else{
forms[frm].controller.focusFirstField();
}
}
/**
* Va al Registro Anterior
*
* @param {JSEvent} event the event that triggered the action
* @properties={typeid:24,uuid:"F5EA831C-3923-4A49-8223-19EDA5D5D560"}
*/
function goPreviousRecord(event) {
var frm = currentcontroller.getName();
if(forms[frm].frmIsEditing){
// If the form is editing a record we ask what to do
globals.askForSaving(frm);
}
if(!forms[frm].frmIsEditing){
var _foundset=forms[frm].foundset
_foundset.loadAllRecords();
_foundset.setSelectedIndex(_foundset.getSelectedIndex()-1);
}else{
forms[frm].controller.focusFirstField();
}
}
/**
* Va al Registro Siguiente
*
* @param {JSEvent} event the event that triggered the action
* @properties={typeid:24,uuid:"E389D3C1-5D05-427C-A96A-4E13398EA8FF"}
*/
function goNextRecord(event) {
var frm = currentcontroller.getName();
if(forms[frm].frmIsEditing){
// If the form is editing a record we ask what to do
globals.askForSaving(frm);
}
if(!forms[frm].frmIsEditing){
var _foundset=forms[frm].foundset
_foundset.loadAllRecords();
_foundset.setSelectedIndex(_foundset.getSelectedIndex()+1);
}else{
forms[frm].controller.focusFirstField();
}
}
/**
* Va al ultimo Registro
*
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"27932FFB-422E-4F3F-AB56-6EC636BEFD3E"}
*/
function goLastRecord(event) {
var frm = currentcontroller.getName();
if(forms[frm].frmIsEditing){
// If the form is editing a record we ask what to do
globals.askForSaving(frm);
}
if(!forms[frm].frmIsEditing){
var _foundset=forms[frm].foundset
_foundset.loadAllRecords();
_foundset.setSelectedIndex(databaseManager.getTableCount(_foundset));
}else{
forms[frm].controller.focusFirstField();
}
}
function goFirstRecord(event) {
var frm = event.getFormName();
//etc..
Users browsing this forum: No registered users and 10 guests