type ahead field not refreshing

I have a panel_members form with a field id_people set as a type ahead control with a value list connected to a large people table. It works fine.

I allow the user to press a button a popup a people form which displays the persons name and allows the user to edit it. When the form closes I want to refresh the panel_members form to reflect the updated people name.

To do this, I do:

databaseManager.refreshRecordFromDatabase(forms.[panel_members.foundset, -1)
forms.panel_members.controller.relookup()

but it doesn’t get refreshed.

I am doing the exact same thing on a id_t_panel_members field on the same form, which is connected to the Panel_member_types table and displayed as a combo box. This works fine, so I thought my problem might be in trying to refresh a type ahead field.

Do you have any idea what might be causing my problem and what to do about it?

Thanks for your help!

looks like a typo. Try this instead:

databaseManager.refreshRecordFromDatabase(forms.panel_members.foundset, -1)
forms.panel_members.controller.relookup()

It was a typo in what I sent you, but thats not the problem.

My actual code is:

databaseManager.refreshRecordFromDatabase(forms[myForm].foundset, -1) 
forms.panel_members.controller.relookup()

But I changed it before I sent it to you to make it clearer – and missed the left bracket.

Using your code produces the same result.

Any other ideas?

Yeah, that was too easy. What are you triggering the method on? Are you sure it is running when it should?

The code is definately running.

here is more of it:

if (myPop == "people_lookup") {
			var myVal = globals.DLookup("name_last", "people", "id_people = " + forms[myForm][myControl])
			globals.retVal = myVal
			var query = "SELECT people.id_people FROM people WHERE people.name_last >= '" +  myVal + "' Order By people.name_last, people.name_first";
			//plugins.dialogs.showInfoDialog( "forms[myForm][myControl]", forms[myForm][myControl])  
			forms.people_lookup.controller.loadRecords(query)			
			application.showFormInDialog(forms[myPop],350,50,470,610, myCaption)
		}
		else {
			application.showFormInDialog(forms[myPop],-1,-1,-1,-1, myCaption)
		}
databaseManager.refreshRecordFromDatabase(forms[myForm].foundset, -1)
forms[myForm].controller.relookup()
//plugins.dialogs.showInfoDialog( "myForm", myForm)

The interesting thing is that the last two lines actually run immediately after the form is popped-up and not after the popup form is closed. Yet, when I change a value in the popup form its related value also changes in the base form (which is what I want) from the panel_members form but not from the people_lookup form.

why are you calling refreshFoundset?
That only flushes all record data and reloads it all. Should only be used when you know a program other then servoy has changed the database. Shouldn’t be nessesary any other way.

and controller.relookup? That just refills the lookup values of the current record of the foundset.

Are you just saying that the values that you see in the typeahead that are based on a table aren’t changed when you lets say change the name of one thing that you display there?
I do cache values so i have to look if those are updated.
For example if you changed a value then you start typing in a typeahead then in the drop down you should see the updated value.. Because that are returned from a query directly. So are only selected values not updated?

Johan,

I took the liberty of creating and emailing you a sample. I think it will be easier to show you what is going on that way.

When you open the solution you will see the Projects form. On it is a tab panel with the panels form, and on it is another tabl panel with the panel_members form.

If you click on the View Types button the the panel_members form, a form will popup displaying all of the available types. If you change the name of one of those types and then close the form, the types with the same name on the panel_members form will reflect the change. That is the effect we want.

However, its not working with the panel_member names.

If you click on a name and then on the View People button, a different popup form will appear, showing lots of names – including the one you clicked on. If you change the name in the popup form, and then close the form, the change is recorded in the database, but its not reflected on the panel_members form. How can we get that to happen?

i will look at it but i didn’t get anything yet through my mail
(did you send it as personal message? Else send it to jcompagner@servoy.com)

I sent it to your email (jcompagner@servoy.com) about 80 minutes ago and just sent it again to you now.

Thanks for your help!

fixed in the next beta (2.2b4)

OK. Thanks.

Johan,

I now have the new beta (2.2b4) and this is better, but it still doesn’t work quite right.

If I change a value on a record in the popup window and then close the popup form, the main form gets refreshed and everything seems fine.

BUT, if I change a value on the popup form and then move to a different record on the popup form and then try to close the popup I can’t. The popup stays open and there is nothing I can do to close it – except to kill the whole application in task manager.

Any advice as to what to do about this would be appreciated.

i can’t reproduce that with youre solution that you send me
If i click view people then change something and then go to the next then also change something.. Then close it all is working fine.

Johan,

The change you made in build 319 does seem to work if the type-ahead field is on a tab-panel if a main form as in the example I sent you.

However, if the type-ahead field is in a dialog window which pops-up another dialog window, it doesn’t work and you get the results I described.

I have sent you and email with a new sample so you can see what I mean.

Johan,

I found an answer, so I don’t need to send you the example (but I still can if you want).

What I discovered is in the situation of a dialog window popping up from another dialog window with a type-ahead field on it, I don’t need to do:

databaseManager.refreshRecordFromDatabase(forms[myForm].foundset, -1)
forms[myForm].controller.relookup()

If I leave this out completely, it works fine. Its only when I have it in that the problem occurs.