i added a group and dropdown ribbon control to the ribbon of a list. The dropdown button controls are filled in dynamically with JavaScript. Selecting a button control from the dropdown returns the correct control id in the Command handler.
handleCommand: function (commandId, properties, sequence) { if (commandId === 'My.PageComponent.Command.PopulateDropDown') { ExecuteOrDelayUntilScriptLoaded(Function.createDelegate(null, GetMeetingsAsXml, 'SP.js'); properties.PopulationXML = GetMeetingsAsXml(); } if (commandId === 'My.PageComponent.Command.DoAction') { var _selectedItem = properties.SourceControlId.toString(); ... } if (commandId === 'My.PageComponent.Command.QueryDoAction') { LoadMeetings(); } }
Most code comes from the often referenced example of Chris O'Brian.
http://www.sharepointnutsandbolts.com/2010/02/ribbon-customizations-dropdown-controls.html
Problem: initially and after selection of an item the closed dropdown is always empty.
1. How can i set the initial item in JavaScript?
2. How can i set the selected item in JavaScript?
3. How can i get the LabelText of the selected item in JavaScript?
4. Is there and how can i access the collection/array of button controls with JavaScript?
Greetings
Peter