Scripts in KUIB2

Posted by MatsRisberg on 04-Sep-2017 09:58

How should the view-factory.js files for KUIB2 be written?

There are no script files created when adding a new page. 

The old ones from KUIB1 doesn't work either, the events doesn't seem to map correctly.


example:

(function(angular) {
    angular
        .module('viewFactories')
        .factory('myPage', ['$q', 'dsService', function($q, dsService) {

            function AccountingBankStatements() {
                this.scope = null;
            }

            MyPage.prototype = {
            onInit: function($stateParams) {
                return $q(function(resolve, reject) {
                    resolve({});
                });
            },
            onHide: function(customData) { },
            onShow: function($scope, customData) {
                myLib.DoStuff();
            }, 
        };
        return new MyPage();
        }]);

})(angular);

Posted by Ruben Dröge on 04-Sep-2017 10:12

Here is a list of items found that needed to be updated manually:

  • Copy images to app/src/image.
  • Copy custom sections files to app/src/modules/<module>/<view>
  • Move functions from view-factory.js to controller.public.js.
  • Move rowTemplate function from view-factory.js to controller.public.js..
  • Move changeHandler was not migrated into controller.public.js.
  • Change references to "_$ds" from "this.scope._$ds." to "this.$ds.".
  • Change references to "_$ds" from "that.scope._$ds." to "that.$ds.".
  • Change references from "this.<component>" to "this.$components.<component>".
  • Change references from "this.scope._$viewModels." to "this.$viewModels.".
  • Change references from "that.scope._$viewModels." to "that.$viewModels.".
  • Change references from "scope.listview.widget" to "this.$components.listview.widget".
  • Change references from "dsService" to "this.$dsService".
  • Copy styles/app folder to app/src/styles/app (this fixes validation messages showing in blank text instead of red text).
  • Function calls function() to this.function().
  • Remove extra folders used in KUIB 1.1 projects but not in KUIB 2.0.
    • resources (make a backup of any customizations)
    • Remove start-web-app.bat -- command line access to the project is available via npm in the app/ folder.
    • The old src/ folder used for extensions can be removed.
    • The build-output/debug folder can be removed - it can be re-generated using the Publish option. Folder has a different structure in KUIB 2.0.

All Replies

Posted by Ruben Dröge on 04-Sep-2017 10:12

Here is a list of items found that needed to be updated manually:

  • Copy images to app/src/image.
  • Copy custom sections files to app/src/modules/<module>/<view>
  • Move functions from view-factory.js to controller.public.js.
  • Move rowTemplate function from view-factory.js to controller.public.js..
  • Move changeHandler was not migrated into controller.public.js.
  • Change references to "_$ds" from "this.scope._$ds." to "this.$ds.".
  • Change references to "_$ds" from "that.scope._$ds." to "that.$ds.".
  • Change references from "this.<component>" to "this.$components.<component>".
  • Change references from "this.scope._$viewModels." to "this.$viewModels.".
  • Change references from "that.scope._$viewModels." to "that.$viewModels.".
  • Change references from "scope.listview.widget" to "this.$components.listview.widget".
  • Change references from "dsService" to "this.$dsService".
  • Copy styles/app folder to app/src/styles/app (this fixes validation messages showing in blank text instead of red text).
  • Function calls function() to this.function().
  • Remove extra folders used in KUIB 1.1 projects but not in KUIB 2.0.
    • resources (make a backup of any customizations)
    • Remove start-web-app.bat -- command line access to the project is available via npm in the app/ folder.
    • The old src/ folder used for extensions can be removed.
    • The build-output/debug folder can be removed - it can be re-generated using the Publish option. Folder has a different structure in KUIB 2.0.

Posted by MatsRisberg on 05-Sep-2017 08:37

Thanks! That helped a lot.

I got my page working, but have a few corrections:

content of $scope._$ds is now located at $scope.vm.$ds

components previous found at $scope is now located at $scope.vm.$components

Posted by Ruben Dröge on 06-Sep-2017 01:28

Glad it helped!

Two questions:

  • what view template were you using in this case?
  • does this.$components (instead of $scope.vm.$components) work for you as well?
This thread is closed