1

Good day!! anyone know how to show the option like Select all and Deselect All for Multilist field type in powershell. Similar kind of functionality available for checklist field type but not available for multilist field type.

I spent lot of time to find the solution/enable the options for multilist field type but no luck. Below is the sample code

$checkListOptions = [ordered]@{
    "Checkbox 1" = 1
    "Checkbox 2" = 2
    "Checkbox 3" = 3
}
 
$dialogParams = @{
    Title = "Dialog title"
    Description = "Description under title"
    OkButtonName = "Execute"
    CancelButtonName = "Close"
    ShowHints = $true
    Parameters = @(
        @{
            Name = "multiListSelector"
            Title = "Multilist Selector"
            Editor = "multiList"
            Source = "DataSource=/sitecore/layout&DatabaseName=master"
            Tooltip = "Select one or more from list"
        }
         @{
            Name = "checkListSelector"
            Title = "Checklist Selector"
            Editor = "checklist"
            Options = $checkListOptions
            Tooltip = "Select one or more options"
        }
    )
}
 
$dialogResult = Read-Variable @dialogParams

Screenshot taken from 6.2

1 Answer 1

1

TL;DR

It is impossible (unless you will modify code)

Here is WHY

There is a class in SPE where this control is created PowerShellMultiValuePrompt

enter image description here

MultilistExtended class can be found also in SPE repo: MultilistExtended

It doesn't have much code because it's a parent class of Sitecore class with few modifications.

If you will decompile Sitecore.Shell.Applications.ContentEditor.MultilistEx

and inspect protected override void DoRender(HtmlTextWriter output) you will notice that the only one buttons that can appear there are already rendered and there is no way to enable something that doesn't exist.

Now if you know where things lives you can decide whether you want to invest time and change the default implementation or not.

If buttons are really important why not just use checklist? You can create checklist values out of items (use IDs as values) and then get list of selected IDs.

1
  • Thanks Alan. I will go with Checklist option instead of investing time on the multilist
    – Karthik
    Nov 2, 2020 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.