Let us consider an example where the details of two Fixed Deposit accounts need to be displayed in the Account Summary widget with offline data on the mobile app. The details of the accounts such as, account number, account name, account type, account status, available balance, etc. along with the Widget ID needs to be in beforeDataLoad CWEC.BEFORE_DATA_LOAD.
For this example, the beforeDataLoad CWEC.BEFORE_DATA_LOAD structure would be as follows:
Code Block | ||
---|---|---|
| ||
CWEH.registerHandler('CT_ACC_SUMMARY_WGT1','beforeDataLoad'CWEC.BEFORE_DATA_LOAD, function (widgetId,paramss,netState,callback) { var params= { "response": { "data": { "ALL_RECORDS": [{ "UNCLEARED_FUND": "10.0", "ACCOUNT_NO": "1105926174623", "CURRENCY": "USD", "TOTAL_COUNT": "5", "ACCOUNT_NAME": "TWO", "OVER_DRAFT_LMT": "0.0", "AVAI_BALANCE": "571140.12", "STATUS": "ACTIVE", "ACCOUNT_TYPE": "FIXED DEPOSIT ACCOUNT" }, { "UNCLEARED_FUND": "10.0", "ACCOUNT_NO": "1105926174662", "CURRENCY": "USD", "TOTAL_COUNT": "5", "ACCOUNT_NAME": "ONE", "OVER_DRAFT_LMT": "0.0", "AVAI_BALANCE": "571140.12", "STATUS": "ACTIVE", "ACCOUNT_TYPE": "FIXED DEPOSIT ACCOUNT" }], 'ADDITIONAL_DATA': { 'MODIFIED_COLUMN_NAMES': { CURRENCY: "Currency" } } }, syncMode:true, cancelLoad:false, dataMerge:true, uniqueColumn: "ACCOUNT_NO" } }; callback.apply(this,[params]); }); CWEH.registerHandler('<WIDGET_ID>','afterDataLoad'CWEC.AFTER_DATA_LOAD, function (widgetId,paramss,netState,callback) { LOGGER.info('response', response) }); |
...