I use this to edit the address record in a dialog, activated from a method in a list view and all works well. Now experimenting with portals I am unable to work out how to edit the selected row in a dialog.
When you coding is correct the selected record is always ‘held’ in the foundset. So, when you ‘move’ a foundset from one form to the other the selected record remains the same.
BTW when you use the same foundset on a number of different records you don’t have to ‘move’ the foundset. It will be the same everywhere including the same record.
When your coding is not that correct because you might use your dialog in all kinds of situations, you could do a simple method that shows the dialog and one that calls it. For example,
// showDialog
var vId = arguments[0],
vFoundset = arguments[1];
if (!vFoundset) { // just shows that one record
controller.find();
id_column = vId;
controller.search();
}
else { // loads the foundset and jumps to the record
controller.load(vFoundset);
controller.selectRecord(vId);
}
application.showFormInDialog(mySelf);
And
// showDetail
forms.myDialog.showDialog(id_column, foundset); // pass record id and foundset
Like this, you can all this dialog from everywhere if you know which record you want to show.
I was unable to get your solution to work and I don’t understand why. I tinkered some more and tried the following code:
var tabindex = forms.companies.elements.tabs_data.tabIndex;
var tabname = forms.companies.elements.tabs_data.getTabTextAt(tabindex);
databaseManager.startTransaction()
switch (tabname)
{
case "Diary Notes":
forms.diary_editDialog.controller.loadRecords(companies_to_diary);
application.showFormInDialog(forms.diary_editDialog,-1,-1,-1,-1,'Edit Diary Entry',false,false,true);
break;
case "Employees":
plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
break;
case "Projects":
plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
break;
case "Address":
plugins.dialogs.showDialog('Alert','To be coded: '+tabname,'OK')
break;
}
This works with this form for editing a diary note…my desired result, but am I over simplfying it or should I just shutup and count my blessings?
hmm. But this is a completely different solution. What if you need to show more than one field? What haven’t you been able to accomplish? Can you post your code?
Attached are the forms I have created. I select the row i wish to edit and select the > button and up pops the dialog with fields ready for data entry.
What if you need to show more than one field?
I do not understand this this question! More than one field is displayed
I haven’t read your post well enough. I only saw plugins.dialogs.showDialog(). Your code looks good, so now you have a solution and no problems anymore?