Question

Onload function is not working

Hi Sir/Madam,

Onload function is not working, request you to please check the below code

define("UsrPersonalDetails1Page", ["jQuery"], function(jQuery) {

   return {

        methods: {            

            onload: function() {

                    $(".control-width-15").hide();

            }

      }

 }

}

Regards

Raghu Ram

Like 0

Like

3 comments

Bpm'online uses ext.js framework's mvvm pattern. Additionally, the system converts code from pages into viewmodels using generators (for example SchemaBuilderV2 (getSchema method) and  ViewModelGeneratorV2) The error was in the fact that you tried to add jquery function into a config for a generator. The config was not connected to a page directly. Technically it's possible to perform something like 

define("AccountPageV2", ["jQuery"], function() {
	return {
		entitySchemaName: "Account",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			onEntityInitialized: function() {
				this.callParent(arguments);
				$("#ProfileContainer")[0].style.backgroundColor = "blue";
			}
		},
		rules: {},
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/
	};
});

but it's very incorrect. Please don't do that.

Please investigate the bpm'online documentation and use out-of-the-box tools that allow creating needed business logic.

Eugene Podkovka,

Hi Sir/Madam,

In the below code I have called init and render but it's not working. Request you to please check.

define("UsrClientDetails1Page", ["jQuery"], function(jQuery) {

    return {

        entitySchemaName: "UsrClientDetails",

        attributes: {},

        modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,

        details: /**SCHEMA_DETAILS*/{

            "Files": {

                "schemaName": "FileDetailV2",

                "entitySchemaName": "UsrClientDetailsFile",

                "filter": {

                    "masterColumn": "Id",

                    "detailColumn": "UsrClientDetails"

                }

            }

        }/**SCHEMA_DETAILS*/,

        businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,

        methods: {

            init: function(callback) {

                setTimeout(callback, 2000);

            },

            render: function(renderTo) {

                $(".grid-layout-column").hide();

            }

        }

    };

});

Regards

Raghu Ram

 

Raghu Ram,

- setTimeout(callback, 2000);

It's not correct to stop all application for some time. Please find other solution.

 - init: function(callback) {

- render: function(renderTo) {

init and render are not asynchronous functions. Please use this.callParent(arguments) instead. Something like

onEntityInitialized: function() {
    this.callParent(arguments);
}

-  $(".grid-layout-column").hide();

jQuery is always a bad solution in case of hiding things. If you need to hide an element that can't be hided by a business rule, please consider using CSS. You can find an example in the article by the link below. 

https://community.bpmonline.com/questions/how-add-custom-style-control-…

 

 

Show all comments