Question

Switch detail list from editable to normal

Hi all,

      I have followed this article https://academy.creatio.com/documents/technic-sdk/7-16/adding-detail-ed… to create a editable list. But I want it comes back to normal with specific master field value (for example: master.status = done), how can I do this?

Thanks

Toan

Like 0

Like

3 comments

Dear Toan, 



Can you please clarify what do you mean exactly under "master field value"?



Kind regards,

Roman

Roman Brown,

For example: I have "Order" and "Product Items". "Order" is the master with status: "New", "Processed". "Product Items" are details of "Order" with relationship by "OrderId". When "Order" is new, user can edit its product items, i.e: price, quantity... But, when "Order" is processed, user can't do anything in that details.

Thanks

Toàn

Toan Mai,

 

You need to bind these two methods to your detail schema and add additional check of the "Order status" column value in the detail (via ESQ for example):

generateActiveRowControlsConfig: function(id, columnsConfig, rowConfig) {
        		this.changeLockStatus();
        		this.columnsConfig = columnsConfig;
                var gridLayoutItems = [];
                var currentColumnIndex = 0;
                this.Terrasoft.each(columnsConfig, function(columnConfig) {
                    var columnName = columnConfig.key[0].name.bindTo;
                    var column = this.getColumnByColumnName(columnName);
                    var cellConfig = column ? this.getCellControlsConfig(column)
                        : this.getNotFoundCellControlsConfig(columnName);
                    cellConfig = this.Ext.apply({
                        layout: {
                            colSpan: columnConfig.cols,
                            column: currentColumnIndex,
                            row: 0,
                            rowSpan: 1
                        }
                    }, cellConfig);
                    cellConfig.enabled = this.isEditableColumn(columnName);
 
                    if (!cellConfig.hasOwnProperty("isNotFound")) {
                        gridLayoutItems.push(cellConfig);
                    }
                    currentColumnIndex += columnConfig.cols;
                }, this);
                var gridData = this.getGridData();
                var activeRow = gridData.get(id);
                var rowClass = {prototype: activeRow};
                BusinessRulesApplier.applyRules(rowClass, gridLayoutItems);
                var viewGenerator = this.Ext.create("Terrasoft.ViewGenerator");
                viewGenerator.viewModelClass = this;
                var gridLayoutConfig = viewGenerator.generateGridLayout({
                    name: this.name,
                    items: gridLayoutItems
                });
                rowConfig.push(gridLayoutConfig);
            },
            isEditableColumn: function (columnName) {
                    return (columnName === "");
                }

As a result once the generateActiveRowControlsConfig method is called it calls the isEditableColumn method and locks all the columns except of those specified in the isEditableColumn method.

 

Best regards,

Oscar

Show all comments