Panel card 1 contains a search part and a list control. Its a list of jobs.
Panel card 2 has the detail view for the Job list. Panel card 2 also has a child list for Appointments with another detail view for that list.
When I add a new Job (parent record), I am taken to panel card 2 to the blank form where I can fill in my data and save. The synchronization policy for both lists have "Client-to-server synchronization" checkbox enabled.
When I click to save the new parent record, it saves to my MySQL database and displays some of the data in the parent list. By default it adds the new record to the bottom of the parent list. My list is sorted from newest (highest primary key #) to oldest (lowest pk #) records so a refresh of the list puts it back on top (sorts it correctly) and pulls linked data from other tables for read-only purposes in the parent list layout. My list layout contains some info from other related tables like customer info (account name, address and so on.) When i save the new parent record, the detail view does not display the primary key for that new record and the related customer data. If I refresh the list, the primary key and all related data from customer table displays in the list and in the detail view.
What is the best way (when adding a new record) to make the client side save and then pull all data back into the client? Every method I have tried is not working out for me. Initially I thought simply checking the client-to-server and server-to-client synch policy options would do it. That didnt work. Then I tried adding a object.refreshListData(JOBLIST); and object.setValue('JOBLIST',0); to the save button. This seemed to work, but only if you were adding a new record. Editing an old record and saving then refreshes the parent list, grabs the first record in the parent list and shows it in the detail view. No good, now were looking at the wrong job and potentially adding child records to the wrong job. Then I tried the following on the afterSynchronizeList event...
This will only refresh the parent list and grab newest record in the list if the primary key (JobID) is blank. That fixed the issue of firing events only for new records, not old ones since the JobID (primary key) doesnt yet exist. This doesnt seem to work 100% of the time. Its hit or miss with the timed javascript. I then tried wrapping separate functions and executing them with the A5.executeThisThenThat code. That still doesnt work.
I dont know what to do. Has anyone else dealt with this or know a good fix?
Panel card 2 has the detail view for the Job list. Panel card 2 also has a child list for Appointments with another detail view for that list.
When I add a new Job (parent record), I am taken to panel card 2 to the blank form where I can fill in my data and save. The synchronization policy for both lists have "Client-to-server synchronization" checkbox enabled.
When I click to save the new parent record, it saves to my MySQL database and displays some of the data in the parent list. By default it adds the new record to the bottom of the parent list. My list is sorted from newest (highest primary key #) to oldest (lowest pk #) records so a refresh of the list puts it back on top (sorts it correctly) and pulls linked data from other tables for read-only purposes in the parent list layout. My list layout contains some info from other related tables like customer info (account name, address and so on.) When i save the new parent record, the detail view does not display the primary key for that new record and the related customer data. If I refresh the list, the primary key and all related data from customer table displays in the list and in the detail view.
What is the best way (when adding a new record) to make the client side save and then pull all data back into the client? Every method I have tried is not working out for me. Initially I thought simply checking the client-to-server and server-to-client synch policy options would do it. That didnt work. Then I tried adding a object.refreshListData(JOBLIST); and object.setValue('JOBLIST',0); to the save button. This seemed to work, but only if you were adding a new record. Editing an old record and saving then refreshes the parent list, grabs the first record in the parent list and shows it in the detail view. No good, now were looking at the wrong job and potentially adding child records to the wrong job. Then I tried the following on the afterSynchronizeList event...
Code:
var JobID = {dialog.Object}.getValue('JobID'); if(JobID==''){ setTimeout(function(){ {dialog.object}.refreshListData('LISTALLJOBS'); setTimeout(function(){ {dialog.Object}.setValue('LISTALLJOBS',0); },500); },300); }
I dont know what to do. Has anyone else dealt with this or know a good fix?