Share Custom View Templates

After you have created and modified your custom view template, you need to share it to make it available to other developers in your account. After you have shared the template, other team members will be able to create new views from it or further modify the template.

If you modify a shared template, you need to push the update to other users.

This article contains the following information:

Share View Templates

You can share a view template only from the app that contains the project for the template. You can share a template from the Views tab or from the Code tab for the app.

To share a template straight from the Views service, complete the following steps:

  1. Open the app in which you want to develop custom templates and navigate to the Views tab.
  2. On the View Templates tab, select the template that you want to share.
  3. Click Share.
  4. Provide name and title for the shared template and click Share with all apps.
  5. Wait for the Views service to reload.

To share a template from the code editor, complete the following steps:

  1. Open the app in which you want to develop custom templates and navigate to the Code tab.
  2. In the Project Navigator, right-click the generator-<generatorName> node.
  3. Select Share As New Template.
  4. Provide name and title for the shared template and click Share with all apps.
  5. Wait for AppBuilder to reload your app and show a confirmation popup.

Note that after the template has been shared, anyone can copy its code locally and modify it. For more information, see Edit the Code of Hybrid View Templates and Edit the Code of NativeScript View Templates.

Use Shared View Templates

After a custom template has become shared, any user in the account can use it in any Views service-enabled app. For more information, see Working With Views: Add New Views.

Modify Shared View Templates

If you discover a bug or need to modify a custom template, you can edit its code inside the app that contains the respective template project or you can copy the template project locally. If the app in which you are trying to modify the shared template does not contain its code, the Views service will prompt you to copy the template project locally.

  1. Open the app in which you want to develop custom templates and navigate to the Views tab.
  2. On the View Templates tab, select the template that you want to edit.
    Note that you cannot edit the code of the default templates maintained by Telerik. You need to create a custom template first.
  3. Click Edit Code.
  4. If prompted, confirm that you want to copy the code of the template into your app.
  5. Wait for the Views service to navigate you to the Code tab for the app.
  6. In the Project Navigator, expand the generator-<generatorName> directory and open the file that you want to modify.

Update Shared View Templates

After you have modified the code of the shared template, you need to push the update to other users.

  1. Verify that you have saved and tested your changes.
  2. In the Project Navigator in the code editor, right-click the generator-<generatorName> node.
  3. Select Update Shared Template.
  4. In the confirmation popup, click Update shared template.
  5. Wait for AppBuilder to reload your app and show a confirmation popup.

After you have updated the shared template, views that use the shared template need to be re-generated.

The next time a developer opens an app which uses views based on an outdated shared template, one of the following occurs:

  • If the shared template is updated only once after the developer has used it in the app, a triangle warning icon appears next to the affected view. In this case, the developer must re-generate the view by modifying it and applying the change.
  • If the shared template is updated more than once after the developer has used it in the app, a prompt to update and re-generate the entire app appears. In this case, the developer must re-generate the entire app before they can continue development.

Based on the update to the shared template, you or your team member might need to re-add the view for the change to become available. The following list outlines how changes become available after an update:

  • New view elements added via model.json or .schema.json automatically become available for use.
  • Modified elements configured via model.json or .schema.json become available only after re-adding the view. Avoid such updates to shared templates.
  • New view elements and code added via templates\view.* or templates\*.js become available in the code after re-generating the app.
  • Modified view elements and code configured via view.* or *.js become available in the code after re-generating the app.

Next Steps

  • Delete or archive unused custom templates.
    If you no longer need to use or maintain a template, you can delete or archive it. If shared, the template will still be available across apps that are using it but developers will no longer be able to use it in new views.
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.