Hi,
I created a Aikau page with two AlfList. I use one in order to filter the other. The problem I encountered is that I don't know if my filters work because I don't manage to refresh the other list, and refresh manually the page (with F5) change nothing!
I can see the list of filters and the list of "conteneurs" but nothing happens when I click on a row of my list of filters.
I can see my json view of the "pisys/conteneurs" webscript (defined in a repo-project) and I can filtered the json adding for exemple "?filter=depot". So I suppose my webscript work.
There is a lot of things I don't understand.
- when and how have I to use the pubSubScope
- when and why I have to use "PROCESS", "CONFIGURED", …
- the role of the publishPayloadModifiers array
- how to use alfPublish, Do I need it?
- Is it me who defined the payload attributes used in the service?
…
There is my actual code (simplified)
page.get.js
<blockcode>
//Filters
var filtres = {
name: "alfresco/lists/AlfList",
config: {
//pubSubScope: "FILTER_SCOPE",
loadDataPublishTopic: "ALF_CRUD_GET_ALL",
loadDataPublishPayload: {
url: "pisys/filtres"
},
itemsProperty: "filtres",
widgets: [
{
name: "alfresco/lists/views/AlfListView",
config: {
widgets: [
{
name: "alfresco/lists/views/layouts/Row",
config: {
widgets: [
{
name: "alfresco/lists/views/layouts/Cell",
config: {
widgets: [
{
name: "alfresco/renderers/PropertyLink",
config: {
propertyToRender: "libelle",
useCurrentItemAsPayload: false,
publishTopic: "FILTER_LIST",
publishPayloadType: "PROCESS",
publishPayloadModifiers: ["processCurrentItemTokens"],
}
}
]
}
}
]
}
}
]
}
}
]
},
};
//list to filter
var conteneurs = {
name: "alfresco/lists/AlfSortablePaginatedList",
config: {
pubSubScope: "DATA_LIST_SCOPE_",
loadDataPublishTopic: "ALF_CRUD_GET_ALL",
loadDataPublishPayload:{
url: "pisys/conteneurs"
},
itemsProperty: "conteneurs",
sortField: "num",
widgets: [
{
name: "alfresco/lists/views/AlfListView",
config: {
additionalCssClasses: "bordered",
widgetsForHeader: [
{
name: "alfresco/lists/views/layouts/HeaderCell",
config: {
label: "Dossier",
sortable: true,
sortValue: "dossier"
}
},
{
name: "alfresco/lists/views/layouts/HeaderCell",
config: {
label: "Conteneur",
sortable: true,
sortValue: "num"
}
}
],
widgets: [
{
name: "alfresco/lists/views/layouts/Row",
config: {
widgets: [
{
name: "alfresco/lists/views/layouts/Cell",
config: {
widgets: [
{
name: "alfresco/renderers/Property",
config: {
propertyToRender: "dossier"
}
}
]
}
},
{
name:"alfresco/lists/views/layouts/Cell",
config: {
widgets: [
{
name: "alfresco/renderers/Property",
config: {
propertyToRender: "num"
}
}
]
}
}
]
}
}
]
}
}
]
},
};
model.jsonModel = {
services: [
"alfresco/services/CrudService",
"filter/FilterService",
],
widgets: [
filtres,
conteneurs
]
};
</blockcode>
the C:\Users\ngaillard\Documents\Alfresco-dev\conteneurs-share\src\main\amp\web\js\filter\filterService.js
<blockcode>
define( ["dojo/_base/declare",
"alfresco/core/Core",
"dojo/_base/lang",
"alfresco/core/CoreXhr",
"service/constants/Default",
"alfresco/documentLibrary/_AlfDocumentListTopicMixin"],
function(declare,Core,lang, CoreXhr, AlfConstants, _AlfDocumentListTopicMixin){
return declare([Core, CoreXhr, _AlfDocumentListTopicMixin], {
constructor: function filter_filterService_constructor(args){
lang.mixin(this,args);
this.alfSubscribe("FILTER_LIST", lang.hitch(this, this.onFilterList));
},
onFilterList: function filter_filterService_onFilterList(payload){
var alfTopic = (payload.alfResponseTopic !=null) ? payload.alfResponseTopic : "";
//if(payload.filter) url = url+"?filter="+payload.filter;
this.serviceXhr({
url: url+"?filter=depot",
method: "GET",
alfTopic: alfTopic,
successCallback : this.alfPublish("ALF_DOCLIST_RELOAD_DATA")
});
}
});
});
</blockcode>