OptionsService not return any resaults

cancel
Showing results for 
Search instead for 
Did you mean: 
iang
Member II

OptionsService not return any resaults

I am confused and frustrated - not an unusual state I admit. However my problem is that despite reworking my code for the last week and finding many silly errors (like trying to use OptionService instead of OptionsService) I still can get this dam select box to populate with a list of users.

I have been able to get it to work using the optionsConfig fixed from the documentation example.

Following Dave Drapers video I can see the users from the service but get an empty select box Smiley Sad

I am now at the point were I dont know what to do next, probably a stupid error (slight dyslexia so used to that) but if anyone can spot it there a virtual brew in it for you.

The form is in a dashlet as follows:

model.jsonModel = {
    rootNodeId: args.htmlid,
    pubSubScope: instance.object.id,
    bodyHeight: "400px",
    services: [
        // {   name: "alfresco/services/LoggingService",
        //     config: {
        //         loggingPreferences:{
        //             enabled: true,
        //             all: true
        //         }
        //     }
        // },
        "alfresco/services/OptionsService"
    ],
    widgets: [
        // {
        //     name: "alfresco/logging/DebugLog",
        // },
        {
            name: "alfresco/dashlets/Dashlet",
            config: {
                title: "My Messages",
                bodyHeight: args.height || null,
                componentId: instance.object.id,
                widgetsForTitleBarActions: [
                    {
                        id: "MESSAGING_DASHLET_ACTIONS",
                        name: "alfresco/html/Label",
                        config: {
                            label: "Title-bar actions"
                        }
                    }
                ],
                widgetsForToolbar: [
                    {
                        id: "MESSAGING_DASHLET_TOOLBAR",
                        name: "alfresco/html/Label",
                        config: {
                            label: "Toolbar"
                        }
                    }
                ],
                widgetsForBody: [
                    {
                        id: "HELLO_DASHLET_VERTICAL_LAYOUT",
                        name: "alfresco/layout/VerticalWidgets",
                        config: {
                            widgetWidth: "350px",
                            widgets: [
                                { name: "alfresco/forms/Form",
                                    config: {
                                        showOkButton: true,
                                        okButtonLabel: "Send",
                                        showCancelButton: false,
                                        okButtonPublishTopic: "PUBLISH_TOPIC_MESSAGE",
                                        okButtonPublishGlobal: true,
                                        widgets: [{
                                            name: "alfresco/forms/controls/TinyMCE",
                                            config: {
                                                fieldId: "MESSAGE_TEXT",
                                                name: "message",
                                                label: "Message",
                                                widgetWidth: 200
                                            }
                                        },
                                        {
                                            name: "alfresco/forms/controls/Radio",
                                            config: {
                                                fieldId: "RECIPENT",
                                                name: "recipient",
                                                label: "Send to",
                                                optionsConfig: {
                                                    publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
                                                    publishPayload: {
                                                        url: url.context + "/proxy/alfresco/api/people",
                                                        itemsAttribute: "people",
                                                        labelAttribute: "firstName",
                                                        valueAttribute: "userName"
                                                    }
                                                }
                                           }
                                        }]
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
};


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
3 Replies
afaust
Master

Re: OptionsService not return any resaults

You say you want to fill a select box with options, yet in the JSON model you have used a "alfresco/forms/controls/Radio" widget. If you want a selection box you need either "alfresco/forms/controls/Select", "alfresco/forms/controls/FilteringSelect" or "alfresco/forms/controls/ComboBox" (depending on additional requirements - the Select widget would be the most basic one).

iang
Member II

Re: OptionsService not return any resaults

I have been trying many options. According to a video I watched should be no difference between select and radio in the way they are populated, both should work from OptionsService.

afaust
Master

Re: OptionsService not return any resaults

I was primarily pointing out the discrepancy between your text and the JSON model. Can you please link which specific video you are talking about?

In current Aikau I cannot find a widget called alfresco/forms/controls/Radio.There is a alfresco/forms/controls/RadioButtons one and that only supports the static "options" attribute.