Видимость отчета в разделе с несколькими страницами
1 февраля 2019 15:06
Нужно настроить видимость отчета в разделе где несколько страниц
Нужна видимость только в определенной странице.
что сделано:
в карточке и разделе:
attributes: {
"VisibleExpenditure":
{
"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"dataValueType": Terrasoft.DataValueType.BOOLEAN,
"value": false
}
}Преопределил функцию:
initCardPrintForms: function(callback, scope) {
var reportsEsq = this.getModulePrintFormsESQ();
reportsEsq.clientESQCacheParameters = {cacheItemName: this.getESQCacheName("CardPrintForms")};
this.initCardPrintFormsEsqFilters(reportsEsq);
reportsEsq.getEntityCollection(function(result) {
if (this.destroyed) {
return;
}
if (result.success && !result.collection.isEmpty()) {
var printFormsMenuCollection = result.collection;
this.preparePrintFormsMenuCollection(printFormsMenuCollection);
printFormsMenuCollection.each(function(item) {
item.set("Click", {bindTo: "generateCardPrintForm"});
if (item.get("Id") === "70ebac9d-d5ce-48c3-aee7-421dfcf0fe40") {
item.set("visible", {bindTo: "VisibleExpenditure"});
}
}, this);
var printMenuItems = this.preparePrintButtonCollection(this.moduleCardPrintFormsCollectionName);
printMenuItems.loadAll(printFormsMenuCollection);
this.set(this.moduleCardPrintFormsCollectionName, printMenuItems);
this.getCardPrintButtonVisible();
}
if (callback) {
callback.call(scope || this);
}
}, this);
}потом в карточке прописал:
onEntityInitialized: function() {
this.callParent(arguments);
var visible = (this.get("WisType").value === "339a6b20-e26f-4f4a-8328-2b238c99e8bd");
this.sandbox.publish("SetVisibleExpenditure", visible, ["SetVisibleExpenditure"]);
this.set("VisibleExpenditure", visible);
}И разделе в разделе:
init: function() {
this.callParent(arguments);
var scope = this;
this.sandbox.subscribe("SetVisibleExpenditure", function(arg) {
scope.set("VisibleExpenditure", arg);
scope.initCardPrintForms();
}, this, ["SetVisibleExpenditure"]);
}Видимость не работает!
При переходе по разным карточкам отчет активный всегда(
Нравится
2 комментария
2 февраля 2019 13:40
Вопрос актуальный! Могу перефразировать: как обновлять выпадающие меню кнопки? Коллекцию изменил, но набор кнопок - тот же
2 февраля 2019 14:01
Решил))) Нужно в функции initCardPrintForms прописать код:
if (!this.get("VisibleExpenditure")) {
printMenuItems.collection.removeAtKey("70ebac9d-d5ce-48c3-aee7-421dfcf0fe40");
}
Показать все комментарии
Войдите или зарегистрируйтесь, что бы комментировать