Quantcast
Viewing latest article 10
Browse Latest Browse All 170

SetRequiredLevel not available in AddOnLoad context

Hi,

I am aiming to set a field's requirement level in an editable subgrid on load. As there's no 'OnLoad' event in an editable subgrid, I used AddOnLoad.

AddOnLoad is set on load of the Contact form. The function in the AddOnLoad is triggered when I open the editable grid's tab. Upon debugging it works, but I cannot find the control property's 'SetRequiredLevel'.

Here's my code:

        public SetMandatoryFields(context) {
            var formContext = context.getFormContext();
            var gridRows = formContext.getGrid().getRows();

            gridRows.forEach(
                function (row) {
                    var attributes = row.getData().getEntity().attributes;

                    attributes.forEach(
                        function (attr) {
                            if (attr.getName() == "new_severity") {
                                var ctrls = attr.controls;
                                ctrls.forEach(
                                    function (ctrl) {
                                        ctrl.setRequiredLevel("required");
                                    }
                                );
                            }
                        }
                    );
                }
            );
        }

It is simple if it's on change of a field in the editable grid but not On Load of the grid.

Thanks!


Viewing latest article 10
Browse Latest Browse All 170

Trending Articles