Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

How to bind a standard control in Cloud POS

Posted on by 15

Hi everybody.

In customer's address information view, there are drop down lists showing Country and State (yellow). I extended this view adding a new drop down list that shows cities' names as aditional information (red).

pastedimage1638286981374v2.png

Within the HTML that I created for this extension the select tag has the following attributes:

<select id="CitiesId"
    data-bind="options: _cities,
    optionsText: 'cityname',
    optionsValue: 'citycode',
    value: CitiesValue,
    optionsCaption: 'Select the City',
    attr: { 'title': 'City' }">
</select>

In typescript, I can easily bind this control declaring a variable as

public CitiesValue: Observable<string>                    // CitiesValue as the select tag value property

And later, in the constructor of the typescript class: 

this.CitiesValue= ko.observable("");
this.CitiesValue.subscribe((newValue: string): void => {
  this._addOrUpdateExtensionProperty("CitiesId", <ProxyEntities.CommercePropertyValue>{ StringValue: newValue }); // CitiesId as the select tag id. _addOrUpdateExtensionProperty sample pos extension method.

 // Do wathever I want
});

In this way I can detect any change in the City drop down list to set in the City field the code of the City.

pastedimage1638287119127v3.png

But I can't perform this for the standard control drop down list State to set a county code in the County field.

The state control has the following html tag.

pastedimage1638287396850v5.png

My question is: how can I bind the control using an Observable to detect the changes?

I can detect changes adding a listener to the control but in this way, the data is not saved.

My typescript class extends AddressAddEditCustomControlBase.

  • Ramune Profile Picture
    Ramune on at
    RE: How to bind a standard control in Cloud POS

    Hi Ricardo,

    As this question is related to the extension, I will leave it for the community to answer. Let's see if anybody has experienced the same and can advise for you anything.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans