Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
After you’ve completed your code updates, it’s time to build and import! Below are instructions for building with the framework you have set for the project.
After you have imported your new widget and refreshed Composer, you will see your new widget as an option on the Mashup Design tab.
When a new version of an extension contains model changes for one or more of its entities, the previous version of the extension and any entities created from that extension must be deleted before installing the new version of the extension. To avoid having to recreate the entities after the new extension is installed, you can include an extension migrator with the extension that imports the entities created with the previous version.
To create a migrator class for your extensions, follow these steps:
Choose the ThingWorx menu and select New Extension Migrator.
Select or enter your source folder and package.
Enter a name, such as CustomMigrator.
Click Finish.
The Java source file is created and the configfiles/metadata.xml file is updated automatically.
NOTE: If a migrator has already been created, the previous migrator class name will be replaced in the metadata.xml file with the new migrator class name. The previous migrator Java file will not be changed.
Use this.jqElement to limit your element selections. This will reduce the chance of introducing unwanted behaviors in the application when there might be duplicate IDs and/or classes in the DOM.
///Don’t do the following: $('.add- btn').click(function(e){...do something...}); ///Do this: this.jqElement.find('.add-btn').click(function(e){ ...do something...});
We recommend that you use the following methods to log in the Mashup Builder and runtime environment:
TW.log.trace(message[,message2,...][,exception]) TW.log.debug(message[,message2,...][,exception]) TW.log.info(message[,message2,...][,exception]) TW.log.warn(message[,message2,...][,exception]) TW.log.error(message[,message2,...][,exception]) TW.log.fatal(message[,message2,...][,exception])
You can view the log messages in the Mashup Builder by opening the log window via the Help->Log menu item; in the Mashup runtime, you can now click on the Show Log button on the top left corner of the page to show log window. If the browser you use supports console.log(), then the messages will also appear in the debugger console.
If you have a property with baseType of STYLEDEFINITION, you can get the style information by calling:
var formatResult = TW.getStyleFromStyleDefinition( widgetProperties['PropertyName']);
If you have a property of baseType of STATEFORMATTING:
var formatResult = TW.getStyleFromStateFormatting({ DataRow: row, StateFormatting: thisWidget.properties['PropertyName'] });
In both cases formatResult is an object with the following defaults:
{ image: '', backgroundColor: '', foregroundColor: '', fontEmphasisBold: false, fontEmphasisItalic: false, fontEmphasisUnderline: false, displayString: '', lineThickness: 1, lineStyle: 'solid', lineColor: '', secondaryBackgroundColor: '', textSize: 'normal' };
Congratulations! You've successfully completed the Create A Mashup Widget Extension tutorial.
You've learned how to:
We recommend the following resources to continue your learning experience:
Capability Guide
Build | Application Development Tips & Tricks |
If you have questions, issues, or need additional information, refer to:
Resource Link
Community | Developer Community Forum |
Help Center | Custom Widget Tips and Example |