Hi Community,
Form this post, (https://community.creatio.com/questions/button-section-page-particular-column) I have managed also to put buttons on each record in section page. Now i need also to do the same on LIST type Dashboard. Any idea how can I do this?
Like
Dear Fulgen,
I don't have an exact example of how to do it. Here is the way how you can override the dashboard:
1) Create your custom module that would extend Terrasoft.DashboardListedGridViewModel
Here is an example:
define("UsrDashboardListedGridViewModel", ["ControlGridModule"], function() {
Ext.define("Terrasoft.UsrDashboardListedGridViewModel", {
extend: "Terrasoft.DashboardListedGridViewModel",
getGridDataColumns: function() {
var gridDataColumns = this.callParent(arguments);
gridDataColumns.QualifyStatus = gridDataColumns.QualifyStatus || {path: "QualifyStatus"};
gridDataColumns.QualificationProcessId =
gridDataColumns.QualificationProcessId || {path: "QualificationProcessId"};
gridDataColumns["QualifyStatus.StageNumber"] =
gridDataColumns["QualifyStatus.StageNumber"] || {path: "QualifyStatus.StageNumber"};
return gridDataColumns;
},
getQualifyStatus:function(id) {
var activeRow;
if (id) {
var gridData = this.getGridData();
activeRow = gridData.get(id);
} else {
activeRow = this.getActiveRow();
}
if (!activeRow) {
return null;
}
var qualifyStatus = activeRow.get("QualifyStatus");
return (qualifyStatus) ? qualifyStatus.value : null;
},
addColumnLink: function(item) {
item.getQualifyStatusValue = function(qualifyStatus) {
if (!qualifyStatus) {
return null;
} else {
return {
value: qualifyStatus && qualifyStatus.StageNumber || this.get("QualifyStatus.StageNumber"),
displayValue: qualifyStatus.displayValue
};
}
};
return this.callParent(arguments);
},
applyControlConfig: function(control) {
control.config = {
className: "Terrasoft.BaseProgressBar",
value: {
"bindTo": "QualifyStatus",
"bindConfig": {"converter": "getQualifyStatusValue"}
},
width: "158px"
};
}
});
return {};
});
2) Create your custom module that would extend Terrasoft.DashboardListedGridViewConfig
Example:
define("UsrDashboardListedGridViewConfig", ["UsrControlGridModule"], function() {
Ext.define("Terrasoft.UsrDashboardListedGridViewConfig", {
extend: "Terrasoft.DashboardListedGridViewConfig",
generate: function() {
var config = this.callParent(arguments);
config.items[1].className = "Terrasoft.UsrControlGrid";
config.items[1].controlColumnName = "QualifyStatus";
config.items[1].applyControlConfig = { bindTo: "applyControlConfig" };
return config;
}
});
return {};
});
3) Create you custom module to override Terrasoft.DashboardGridModule:
define("UsrDashboardGridModule", ["UsrDashboardListedGridViewModel", "UsrDashboardListedGridViewConfig"], function() {
Ext.define("Terrasoft.configuration.UsrDashboardGridModule", {
alternateClassName: "Terrasoft.UsrDashboardGridModule",
override: "Terrasoft.DashboardGridModule",
viewModelClassName: "Terrasoft.UsrDashboardListedGridViewModel",
viewConfigClassName: "Terrasoft.UsrDashboardListedGridViewConfig"
});
});
4) Create your DashboardGridModuleWrapper, which enables UsrDashboardGridModule :
define("UsrDashboardGridModuleWrapper", ["BaseModule"], function() {
Ext.define("Terrasoft.configuration.UsrDashboardGridModuleWrapper", {
extend: "Terrasoft.BaseModule",
alternateClassName: "Terrasoft.UsrDashboardGridModuleWrapper",
constructor: function() {
var parentMethod = this.getParentMethod(this, arguments);
Terrasoft.require(["DashboardGridModule"], function() {
Terrasoft.require(["UsrDashboardGridModule"], parentMethod, this);
}, this);
}
});
return Ext.create("Terrasoft.UsrDashboardGridModuleWrapper");
});
5) Override BootstrapModulesV2 and add DashboardGridModuleWrapper to the dependencies:
define("BootstrapModulesV2", ["UsrDashboardGridModuleWrapper"], function() {
return {};
});
You can use this idea to implement the logic from the article you've mentioned to the list dashboard.