Identityserver4.admin: No binding between pickers and ViewModels

Created on 28 Sep 2018  路  2Comments  路  Source: skoruba/IdentityServer4.Admin

I can't find any connection between MVC ViewModel and your KO pickers. params.hiddenId is undefined.

<div class="form-group row">
        <label asp-for="AllowedCorsOrigins" class="col-sm-3 col-form-label">
            @await Html.PartialAsync("Client/Section/Label", "AllowedCorsOrigins")
        </label>
        <div class="col-sm-9">
            <picker param="multipleSelect=true; hiddenId=AllowedCordOrigins" id="AllowedCorsOriginsItems" multiple-select="true" min-search-text="2"
                    selected-items="@Model.AllowedCorsOrigins" search-input-placeholder="Enter 2 and more characters 1"
                    selected-items-title="Selected: ">
            </picker>
        </div>
    </div>

You have multiple attributes for picker, but no params attr. What am I missing?

question

Most helpful comment

Please, take a look at - Scripts/App/components/Picker.js (https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Scripts/App/components/Picker.js), there is ViewModel - that contains the list of parameters which are bound with ko properties.
Check method sync that writes current selected item/s to hidden field. - https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Scripts/App/components/Picker.js#L180-L195

ko.Picker is rendered via tag helper - https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Helpers/TagHelpers/PickerTagHelper.cs

If you have any questions, let me know.
Thanks!

All 2 comments

Please, take a look at - Scripts/App/components/Picker.js (https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Scripts/App/components/Picker.js), there is ViewModel - that contains the list of parameters which are bound with ko properties.
Check method sync that writes current selected item/s to hidden field. - https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Scripts/App/components/Picker.js#L180-L195

ko.Picker is rendered via tag helper - https://github.com/skoruba/IdentityServer4.Admin/blob/master/src/Skoruba.IdentityServer4.Admin/Helpers/TagHelpers/PickerTagHelper.cs

If you have any questions, let me know.
Thanks!

There was a typo in my imports and the tag helper was not used at all. It works now, thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aegide picture Aegide  路  4Comments

papyr picture papyr  路  3Comments

weedkiller picture weedkiller  路  4Comments

saeedrahimi picture saeedrahimi  路  3Comments

Hens94 picture Hens94  路  4Comments