JavaScript CookBook/Smart Client Interaction/Manipulating the current Smart Client status via Javascript

From GeoMedia Smart Client
Jump to: navigation, search
GMSC 2013/2014 Javascript API Overview Form Events Types Utility Functions client-side Validation Conditions Interaction with SmartClient Cookbook Cheatsheet


Manipulating the current Smart Client status via Javascript

Problem: You want to manipulate the current Smart Client status (e.g. map extent shown, active feature) via a custom script.

Solution: See the SmartClient Javascript API page for a list of script actions to control the smart client. The most common use case is to assign a Smart Client script action to a form button:

    <FormAction name="ClearActiveFeature" label="Clear active feature"  action="SCRIPT[SC.clearActiveFeature()]" />

If you want to execute your SmartClient script actions directly after the workflow page has loaded, you have to use the smartclient:ready event in your custom script:

//execute your script actions after both workflow and smartclient api have finished loading
IG.vent.on('smartclient:ready', function (e) {
    //e is the event object and has two properties:
    // - e.smartClient - reference to the Smart Client instance
    // - e.form OR e.list - reference to the current form or overview list
    e.smartClient.setActiveFeature('Building Extension'); //set 'Building Extension' as active feature
});


Other Recipes in this category: