Placing the SheetView component on a Visualforce page globally exposes the MsmxSheet JavaScript object in the page. By making an API call from this object, it is possible to dynamically control Sheet's behavior and rendering.
API Methods
setApplicationParameter(params, options)
This API sets the application parameters for the Sheet application. Application parameters can be specified as references when specifying filter values. If the reference for the appropriate parameter is set in the filter, the reference is replaced with the value of the parameter and the sheet display is automatically refreshed.
In the filters for text type or ID type field, and advanced filters, the values of application parameters can be specified as reference and used as filter values. See "Using Reference Value in Filter" for more information.
// Pass application parameter names and its values in Key-Value pairsMsmxSheet.setApplicationParameter({ Name:'Salesforce', Type: ['Partner','Customer'] // multiple parameters can be passed in array});// Unset "Type" parameterMsmxSheet.setApplicationParameter({ Name:'Salesforce'},{ forceLoad:true// refresh foreground sheet if no parameter changes});
Parameters
params - (required) Pass application parameter names and its values in Key-Value pairs.
options - (optional) Option parameters. With the forceLoad option property you can force the data refresh
updateApplicationParameter(params, options)
Update application parameter values set in the Sheet Application. The difference with setApplicationParameter is that it replaces only the value of specified parameters and others will be remained as previous.
Parameters
params - (required) Pass application parameter names and its values in Key-Value pairs.
options - (optional) Option parameters. With the forceLoad option property you can force the data refresh
// Subscribe record load completion event of the sheet
MsmxSheet.subscribeComponentEvent(
'comp-01',
'a002800001O6vOpAAJ/s1',
'loadComplete',
function(res) {
console.log(res.records); // List of records loaded
}
);
// Subscribe record selection change event of the sheet
MsmxSheet.subscribeComponentEvent(
'comp-01',
'a002800001O6vOpAAJ/s1',
'selectRecords',
function(res) {
console.log(res.records); // List of records selected in record selection checkbox
}
);