Offline Data Example 2
Let us consider an example where details of two Contra Account numbers need to be displayed in the Sweep Structure List widget with offline data on the mobile app. The details of the contra accounts such as, contra account number, control account number, currency, sweep amount, sweep frequency, sweep type, etc. along with the Widget ID needs to be in CWEC.BEFORE_DATA_LOAD.
For this example, the CWEC.BEFORE_DATA_LOAD structure would be as follows:
CWEH.registerHandler('WGT_STRUC_LIST',CWEC.BEFORE_DATA_LOAD, function (widgetId,paramss,netState,callback) { var params= { "response": { "data": { "ALL_RECORDS": [{ "AMOUNT": "5,000.00", "CONTRA_ACC_CCY": "USD", "CONTRA_ACC_NO": "4324617483242", "CONTROL_ACC_CCY": "USD", "CONTROL_ACC_NO": "4324964324643", "EXEC_FREQ": "Daily", "INSTR_END_DATE": "10/15/2015", "INSTR_ID": "2.0", "INSTR_START_DATE": "04/15/2014", "NEXT_EXEC_DATE": "09/30/2014", "STATUS": "Suspend", "STR_ID": "10021.0", "STR_NAME": "ZFS A CORP", "STR_TYPE": "Cross Currency Sweep", "SWEEP_TYPE": "Zero Balance" }, { "AMOUNT": "25,000.00", "CONTRA_ACC_CCY": "USD", "CONTRA_ACC_NO": "7397862340148", "CONTROL_ACC_CCY": "USD", "CONTROL_ACC_NO": "103456623751", "EXEC_FREQ": "Daily", "INSTR_END_DATE": "01/24/2015", "INSTR_ID": "1.0", "INSTR_START_DATE": "01/25/2014", "NEXT_EXEC_DATE": "10/04/2014", "STATUS": "Active", "STR_ID": "10532.0", "STR_NAME": "GSD A CORP", "STR_TYPE": "Cross Border Sweep", "SWEEP_TYPE": "Range Balance" }], 'ADDITIONAL_DATA': { 'MODIFIED_COLUMN_NAMES': { CURRENCY: "Currency" } } }, syncMode:true, cancelLoad:false, dataMerge:true, uniqueColumn: "ACCOUNT_NO" } }; callback.apply(this,[params]); }); CWEH.registerHandler'<WIDGET_ID>',CWEC.AFTER_DATA_LOAD, function (widgetId,paramss,netState,callback) { LOGGER.info('response', response) });
The following screen shot displays the Sweep Structure List widget with and without internet connectivity. The screen shot on the left-hand side shows the Sweep Structure List widget with remote data (with Internet) and the right-hand side shows the Sweep Structure List widget with local data (without Internet).