• Add and Keep Custom Code Changes in Your App

Add and Keep Custom Code Changes in Your App

Most of the operations you can perform in the Views service require a re-generation of your app. During this process, custom changes made with AppBuilder might be lost. To avoid data loss, make sure to place your custom code within the dedicated block comments.

This article contains the following information:

How to Add Custom JavaScript Code

If you want to add custom code in a JavaScript file, look for the following block comments:

// START_CUSTOM_CODE_nameOfTheComponent
// END_CUSTOM_CODE_nameOfTheComponent

Always place your code between the start and end statements of the block comment.

JavaScript Example

For example, if you are using the Progress Data Service as a data provider, you can handle some of the Progress Data Service events in a custom code block at the end of the index.js file of the master detail view.

// START_CUSTOM_CODE_newdataListViewModel
// you can handle the beforeFill / afterFill events here.
app.newdataListView.newdataListViewModel.jsdoOptions.events = {
    'beforeFill' : [ {
        scope : app.newdataListView.newdataListViewModel,
        fn : function (jsdo, success, request) {
            // beforeFill event handler statements ...
        }
    } ]
};
// END_CUSTOM_CODE_newdataListViewModel

How to Add Custom HTML Code

If you want to add custom code in a HTML file, look for the following block comments:

<!-- START_CUSTOM_CODE_nameOfTheComponent -->
<!-- END_CUSTOM_CODE_nameOfTheComponent -->

Always place your code between the start and end statements of the block comment.

How to Add Custom CSS Code

If you want to add custom code in a HTML file, look for the following block comments:

/* START_CUSTOM_CODE_nameOfTheComponent */
/* END_CUSTOM_CODE_nameOfTheComponent */

Always place your code between the start and end statements of the block comment.

How to Add Custom XML Code

If you want to add custom code in an XML file, look for the block comment quoted below and add your code between the start and end statements of the block comment.

<!-- START_CUSTOM_CODE_nameOfTheComponent -->
<!-- END_CUSTOM_CODE_nameOfTheComponent -->

Note that if you delete part of the start or end statements of the block comment, the Views service won't be able to distinguish your custom code and might overwrite it.

The aforementioned block comments are available in the files that are generated by the Views service for your app, views, data providers and themes (styles).

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.