Serenity: Initial value in combo (Select2Editor)

Created on 1 Jun 2018  路  2Comments  路  Source: serenity-is/Serenity

I am trying to set initial value in Hardcoded Values Editor, but it does not seem to work.

And I cannot find any OnInitialize event, where I could set the value.

any idea how to do it?

    @Serenity.Decorators.registerEditor()
    export class PatternSearchEditor extends Serenity.Select2Editor<any, any> {

        constructor(container: JQuery) {
            super(container, null);

            // add option accepts a key (id) value and display text value
            this.addOption("s", "starts with");
            this.addOption("%", "includes");
            this.addOption("|", "ends with");

            //this does not work
            this.set_value("s");

        }
community-support question

All 2 comments

Try using this.value = "S" instead of this.set_values

OMFG! I must have been stoned or braindead. I would swear it did not work when I tried it the first time.
WORKS NOW, THX @Estrusco

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stepankurdylo picture stepankurdylo  路  3Comments

stixoffire picture stixoffire  路  3Comments

moostafaa picture moostafaa  路  3Comments

AmuthaKondusamy picture AmuthaKondusamy  路  3Comments

john20xdoe picture john20xdoe  路  3Comments