jQWidgets Forums
jQuery UI Widgets › Forums › Editors › Editor › Fonts drop-down in editor
This topic contains 5 replies, has 2 voices, and was last updated by silvochka 9 years, 8 months ago.
-
Author
-
Hi
Could you please help me?
I would like to add some fonts to font drop-down.
I call function in createCommand if name is ‘font’.If I my function has next code:
return {
value: [
{ label: “Calibri”, value: “Calibri, sans-serif” }
]
}Then I see in drop-down label ‘Calibri, sans-serif’. Yes, may be my system doesn’t contains this font. But WHY?? I set label = Calibri. Why you show value instead of label?
if my function return next:
return {
init: function (widget) {
widget.jqxDropDownList({
source: [
{ label: “Calibri”, value: “Calibri, sans-serif” }
]
});
}
}then your drop-down not works at all! I select text, select font. Font is applied to test, but when I click to text to determine font, this drop-down show wrong value!
Could you please help me, how I can work with your font drop-down?
Thanks,
EvgeniaHello Evgenia,
Try adding displayMember and valueMember properties of the dropdownList:
widget.jqxDropDownList({ source: [ { label: "Calibri", value: "Calibri, sans-serif" } ], displayMember: 'label', valueMember: 'value' });
Best Regards,
VladimirjQWidgets Team
http://www.jqwidgets.comThank you for quick answer. But it still not work
I’ve tried
return { value: [ { label: "Calibri", value: "Calibri, sans-serif" } ], displayMember: 'label', valueMember: 'value' }
font detection works, but I still see ‘Calibri, sans-serif’ instead of ‘Calibri’.
When I trying to
return { init: function (widget) { widget.jqxDropDownList({ source: [ { label: "Calibri", value: "Calibri, sans-serif" } ], displayMember: 'label', valueMember: 'value' }); } }
then I see good labels (but I see good labels also without displayMember and valueMember), but font detecting doesn’t work. I apply one font, then click on text and in font drop-down see another value.
Thanks,
EvgeniaHello Evgenia,
I am a little bit at a loss on what you want to achieve here.
What do you mean by font detect and how is that connected to the dropDownList?
When and how do you perform this detection and what exactly is the expected result?Best Regards,
VladimirjQWidgets Team
http://www.jqwidgets.comHello Evgenia,
I figured out what you are trying to do.
The detection itself is based on the browser, so the editor requests the browser to identify the font. As an example if you try to add
{ label: 'Helvetica', value: '"Helvetica Neue", Helvetica, Arial, sans-serif'}
The Helvetica font would be recognized as Arial as it fallsback to Arial.
Unfortunately there is nothing we can do about it.Best Regards,
VladimirjQWidgets Team
http://www.jqwidgets.comThanks, I solved this issue by myself.
Root cause: jqeditor search localization of given label (font name). For ‘Calibri’ it couldn’t find localization label.
And ‘of course’ set it to ‘undefined’ instead of given value.
Thanks,
Evgenia -
AuthorPosts
You must be logged in to reply to this topic.