Overview
...
Dynamic Data
Updating Dynamic Data
4 min
the employee's details are updated using the dynamic data provider's update method in this example the same employee list ( reading dynamic data docid\ mo7yv dv u8jy0duany8y ) is used to select the employee and then populate the employee form ( creating dynamic data docid\ kug1cezwlhdliubvo2u3p ) with the employee's existing details edit the required details and update the record in the dynamic data table datasources, jigs, components & actions default jigx is the database where the dynamic data table is defined sqlite docid 7ekejq4azyvhu6dnss6rt datasource calls the dynamic data provider, using an sql query to return the data jig list docid\ sjsrtshfgxmar0jup6 dt is the type of jig used to list the data in an expander docid\ aah6xkffsvasypnjiyi 2 component with an oncontentpress action with parameters to transfer the selected employee's details to the form form docid 0stw78spssktrq9wbmxau is the component used with initialvalue properties to populate the employee data into the form fields submit form docid\ zuezri5gnzf0xrvvoccpa is the action that executes the update method of the dynamic dataprovider with the recordid property configured to identify the record in the table that must be updated examples and code snippets update dynamic data record use the employee list with component expanders add the oncontentpress action that will open the employee form, add parameters to transfer the employee details to the form list employees jigx title employee list type jig list icon upload bottom header type component jig header options height medium children type component image options source uri https //images unsplash com/photo 1531545514256 b1400bc00f31?q=80\&w=1374\&auto=format\&fit=crop\&ixlib=rb 4 0 3\&ixid=m3wxmja3fdb8mhxwag90by1wywdlfhx8fgvufdb8fhx8fa%3d%3d onfocus type action action list options issequential true actions \ type action sync entities options provider data provider dynamic entities \ default/employee datasources my employees type datasource sqlite options provider data provider dynamic entities \ default/employee query select id, '$ first name', '$ last name', '$ job title', '$ email', '$ start date', '$ department', '$ contact', '$ address' from \[default/employee] data =@ctx datasources my employees item type component expander options header centerelement type component titles options title =(@ctx current item first name & ' ' & @ctx current item last name) subtitle =@ctx current item job title icon person children \ type component entity options children \ type component entity field options label position value =@ctx current item job title \ type component entity field options label department value =@ctx current item department \ type component entity field options label contact value =@ctx current item contact contenttype phone \ type component entity field options label email value =@ctx current item email contenttype email \# when the list item is expanded and you press on the details you are directed to the form that is populated with the employee's details oncontentpress type action go to options \# specifiy the jig to go to linkto update employees \# set a inputs for the current selected item so that the data record will populate in the form's initialvalue field inputs employee detail =@ctx current item default jigx tables employee null index jigx name employees title employees category business tabs home jigid list employees icon home apps logo in the pre populate update employee form add the action submit form using thedynamic data provider with the update method to update the data record the record is updated intstantly and the new employee details are shown in the list update employee jigx title update employee type jig default header type component jig header options height medium children type component image options source uri https //images unsplash com/photo 1522202176988 66273c2fd55f?q=80\&w=1471\&auto=format\&fit=crop\&ixlib=rb 4 0 3\&ixid=m3wxmja3fdb8mhxwag90by1wywdlfhx8fgvufdb8fhx8fa%3d%3d children \ type component section options title personal information children \ type component form \# give the form an id instanceid update form options children \ type component text field instanceid id options label id \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail id ishidden true \ type component text field instanceid first name options label first name \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail first name \ type component text field instanceid last name options label last name \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail last name \ type component text field instanceid address options label address \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail address \ type component text field instanceid contact options label contact information \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail contact \ type component text field instanceid email options label email \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail email \ type component section options title employment information children \ type component text field instanceid job title options label job title \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail job title \ type component text field instanceid department options label department \# populate the field using the input parameter set in the list jig for the selected employee initialvalue =@ctx jig inputs employee detail department actions \ children \ type action submit form options \# the formid is used to get the context to the fields and values that need updating in the form formid update form \# the dynamic data provider uses the update method to update the record in the employee table provider data provider dynamic title update record entity default/employee method update \# the specify the record that must be updated in the dynamic data table by referencing the current data stata of the components in the form recordid =@ctx components update form state data onsuccess type action go back index jigx name employees title employees category business tabs home jigid list employees icon home apps logo update jigid update employee form icon upload button alternate navigate to the solution's data option in jigx management and view the updated dynamic data employee table and record updated dynamic data record