bbros
Sep 20, 2021, 3:06 PM
Hello!
I need to draw a flag icon in a button in order to show the selected language.
The button is in _Header.cshtml, so I don't have codebehind.
I would like to set it via javascript.
The following code works fine:
<ext-button id="LanguageButton"
variant="Light"
scale="Medium"
text=""
hidden="false"
icon="/images/flag_italy.png"
margin="5"
onClientClick="">
<menu>
<ext-menu plain="true">
<items>
<ext-menuItem id="LangItMenuItem" text="Italiano" icon="/images/flag_italy.png">
<listeners>
<click handler="alert('Italiano!');" />
</listeners>
</ext-menuItem>
<ext-menuItem id="LangEnMenuItem" text="English" icon="/images/flag_usa.png">
<listeners>
<click handler="alert('English!');" />
</listeners>
</ext-menuItem>
</items>
</ext-menu>
</menu>
</ext-button>
I would like to create a js which reads inside a cookie the preferred language and sets the correct icon to the LanguageButton.
App.LanguageButton.setIcon('...') or App.LanguageButton.icon = '...' do not work;
I tried to use the iconCls but it becomes white (maybe because of a wrong implementation).
.bbros-flag-it {
background:url(/images/flag_italy.png);
}
Could you please help me?
Thank you much!
I need to draw a flag icon in a button in order to show the selected language.
The button is in _Header.cshtml, so I don't have codebehind.
I would like to set it via javascript.
The following code works fine:
<ext-button id="LanguageButton"
variant="Light"
scale="Medium"
text=""
hidden="false"
icon="/images/flag_italy.png"
margin="5"
onClientClick="">
<menu>
<ext-menu plain="true">
<items>
<ext-menuItem id="LangItMenuItem" text="Italiano" icon="/images/flag_italy.png">
<listeners>
<click handler="alert('Italiano!');" />
</listeners>
</ext-menuItem>
<ext-menuItem id="LangEnMenuItem" text="English" icon="/images/flag_usa.png">
<listeners>
<click handler="alert('English!');" />
</listeners>
</ext-menuItem>
</items>
</ext-menu>
</menu>
</ext-button>
I would like to create a js which reads inside a cookie the preferred language and sets the correct icon to the LanguageButton.
App.LanguageButton.setIcon('...') or App.LanguageButton.icon = '...' do not work;
I tried to use the iconCls but it becomes white (maybe because of a wrong implementation).
.bbros-flag-it {
background:url(/images/flag_italy.png);
}
Could you please help me?
Thank you much!