I am using Alfresco 5.1.e
In the search page "/share/page/dp/ws/faceted-search". I have included a button "AlfDynamicPayloadButton".
When the button is clicked it opens a dialog with "ALF_CREATE_DIALOG_REQUEST" and inside of it my custom widget.
I need the current search parameters into that widget to create a special visualisation.
My code in the file "faceted-search.get.js":
var myWidget = {
name : "alfresco/buttons/AlfDynamicPayloadButton",
config : {
label : "My Button",
useHash : true,
hashDataMapping : {
"hashFragmentParameterName" : "buttonPayloadProperty"
},
publishPayloadSubscriptions : [ {
topic : "ALF_SEARCH_REQUEST"
}],
publishTopic : "ALF_CREATE_DIALOG_REQUEST",
publishPayloadType : "PROCESS",
publishPayloadModifiers : [ "processDataBindings" ],
publishPayload : {
dialogTitle : "My Title",
widgetsContent : [ {
name : "myPackage/Example",
config : {
width : 400,
height : 500
// other configurations
}
}]
}
}
};
var widget = widgetUtils.findObject(model.jsonModel.widgets, "id",
"FCTSRCH_TOP_MENU_BAR");
widget.config.widgets.push(myWidget);
My Widget:
define(
[
"dojo/_base/declare",
"dijit/_WidgetBase",
"alfresco/core/Core",
"dijit/_TemplatedMixin",
"dojo/_base/lang",
"dojo/text!./html/Example.html"
],
function(declare, _Widget, Core, _Templated, lang, template) {
[ _Widget, Core, _Templated ],{
templateString : template,
i18nRequirements : [ {
i18nFile : "./i18n/Example.properties"
} ],
cssRequirements : [ {
cssFile : "./css/Example.css"
} ],
constructor : function example__constructor() {
// the widget is created each time the button is pressed
this.alfSubscribe("ALF_SEARCH_REQUEST",
lang.hitch(this, this.upgradeSearchParameter));
this.inherited(arguments);
},
upgradeSearchParameter:
function example__upgradeSearchParameter(args){
// this line never run
this.searchParameter = args;
}
});
});
So far I have tried:
- Subscribe inside the widget to ALF_SEARCH_REQUEST. The problem with that is the widget haven't been created when topic is published.
- Include "alfresco/services/SearchService" has dependency of my widget. I can access with that to some information of the query like the "sort", "site", "sortAscending", etc, but not the "term".
- Include "alfresco/search/AlfSearchList" has dependency of my widget. I have "searchTerm", but it is always empty "".
Using "publishPayloadSubscriptions" in my button. All the information of the parameters of the query are inside of the dialog, but it not exists option to populate my widget with that information
publishPayloadSubscriptions : [ { topic : "ALF_SEARCH_REQUEST" }],
Is there some way to get all the parameters of the last query in my custom widget?