Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Set initial and selected item for js-dynamically filled ribbon dropdown

$
0
0

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



Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>