This is standard register view which shows data collected so far for each beneficary. The register view is designed such that it replicates the paper registers field workers are comfortable with. This view is the one which opens up right after clicking on Register on Home.
To build a main datagrid for your register you need to
- Create an Activity extending SmartRegisterSecuredActivity that holds up the main view, forms, and details fragments for register like this.
- Create a BaseFragment extending SecuredNativeSmartRegisterFragment that renders the beneficairy records in listview and manages paging and data entry forms as here
- Create a DetailFragment extending DetailFragment that shows all details associated with beneficiary like this. This is explained in details here.
1- Create Register Activity
The first step to register building is creating an activity that manages fragments, forms, details, and navigation. As mentioned above implement SmartRegisterSecuredActivity .
Example Register Activity
public class MyRegisterActivity extends SmartRegisterSecuredActivity { @Override public SecuredNativeSmartRegisterFragment makeBaseFragment() { // Return a fragment which generates the list view i.e. main grid fragment. Example is given below return new MyMainRegisterFragment(new FormController(this)); } @Override public DetailFragment getDetailFragment() { // Fragment handling details view for list records. Example would be in section Details view // Or return null if no details view is applicable return new MyDetailFragment(); } @Override protected String[] buildFormNameList() { // Return a list of form names which would participate in data collection from this register. // These froms are added to assets and generated via xlsforms List<String> formNames = new ArrayList<String>(); formNames.add("my_form1"); formNames.add("my_form2"); formNames.add("my_form3"); return formNames.toArray(new String[formNames.size()]); } @Override public String postFormSubmissionRecordFilterField() { // The field which filters out data on successful form submission to highlight the new/updated record. // The field should be a valid non-null field in your xlsform and should identify record uniquely, otherwise multiple records would be highlighted // Return null if no data needs to be highlighted return "my_beneficiary_id_in_form_submission"; } @Override protected void onResumption() { // Any custom tasks on Resumption of activity } }
2- Create Base Fragment
Once you have created register activity, next step is to create the fragment that is actually reponsible for showing list records i.e. main grid. The example is here
Example Base Register Fragment
Add Comment