SyntaxError: Illegal character in Kendo UI Template - syntax-error

I have a kendo grid in a page. I need to add Itemtemplate for custom filtering. I want to add it inline, not with a function.
I have started to write the code:
... .Title(LanguageService.Instance.Translate("Status")).Visible(true).Width(110)
.Filterable(ftb => ftb.Multi(true)
.ItemTemplate(
"#if (StatusId = 1) { #" + Enums.PublicationStatus.New.ToString() +
" # } #" ).CheckAll(false).BindTo(new[] {......}
But I keep get the error: SyntaxError: illegal character
I have checked here: https://docs.telerik.com/kendo-ui/framework/templates/overview
and it says that the code should be placed between the the # (hash) sign.
If I don't add any code only an empty string, I don't get errors.
What am I missing here?

Related

Get the caret position for Blazor text input

I am working on a Blazor textarea input. What I want to achieve is whenever user types "#" character, I am going to popup a small window and they can select something from it. Whatever they select, I will insert that text into the textarea, right after where they typed the "#".
I got this HTML:
<textarea rows="10" class="form-control" id="CSTemplate" #bind="original" #oninput="(e => InputHandler(e.Value))" #onkeypress="#(e => KeyWasPressed(e))"></textarea>
And the codes are:
protected void InputHandler(object value)
{
original = value.ToString();
}
private void KeyWasPressed(KeyboardEventArgs args)
{
if (args.Key == "#")
{
showVariables = true;
}
}
protected void AddVariable(string v)
{
original += v + " ";
showVariables = false;
}
This worked very well. The showVariables boolean is how I control the pop-up window and AddVariable function is how I add the selected text back to the textarea.
However, there is one small problem. If I've already typed certain text and then I go back to any previous position and typed "#", menu will still pop-up no problem, but when user selects the text and the insert is of course only appended to the end of the text. I am having trouble trying to get the exact caret position of when the "#" was so I only append the text right after the "#", not to the end of the input.
Thanks a lot!
I did fast demo app, check it https://github.com/Lupusa87/BlazorDisplayMenuAtCaret
I got it - I was able to use JSInterop to obtain the cursor position $('#CSTemplate').prop("selectionStart") and save the value in a variable. Then use this value later in the AddVariable function.
you can set your condition in InputHandler and when you are checking for the # to see if it's inputed you can also get the length to see that if it's just an # or it has some characters before or after it obviously when the length is 1 and value is # it means there is just an # and if length is more than one then ...

Ejabberd: bad argument in call to fxml:element_to_binary

I'm not well experienced in erlang but need to resolve some task.
I have added some processing before sending xml to user in ejabberd_c2s.erl file. If I recognize my custom tag I need to add another one to the message
this is original
send_element(StateData, El) ->
send_text(StateData, fxml:element_to_binary(El)).
my change simplified is something like this
send_element(StateData, El) ->
NewEl = fxml:append_subtags(El, [create_tag()]);
send_text(StateData, fxml:element_to_binary(NewEl))
create_tag(Body) ->
#xmlel{name = <<"myTag">>, attrs = [<<"attrib1">>,<<"value1">>], children = []}.
Whatever I do I get error "bad argument in call to fxml:element_to_binary(..."
I have printed out the El before and after adding tag and everything looks OK after adding new tag

i18next json dot in key or label

JS: i18n.t("SOME TEXT TO BE TRANSLATED.")
JSON: "SOME TEXT TO BE TRANSLATED.": "Een stukje tekst om te vertalen"
i18n.t("SOME TEXT TO BE TRANSLATED.") gives me "SOME TEXT TO BE TRANSLATED.".
If I remove the "." (dot) from the label and the function t, than the text is translated.
How to solve this?
Documentation explains that dot is by default treated as a key separator. You can
replace dot with .
put dot outside translated string i18n.t("SOME TEXT TO BE TRANSLATED") + "."
change key separator
You can change namespace and/or key separator by setting options on init:
nsSeparator: ':::'
keySeparator: '::'
You can set "keySeparator" : false in your init option.
You could try using https://github.com/cheton/i18next-text. It allows you using i18next translation without having the key as strings, and you do not need to worry about i18n key naming. Furthermore, you can also register the i18n helper with Handlebars.
Following is a simple example:
var i18n = require('i18next');
// extends i18n object to provide a new _() method
i18n._ = require('i18next-text')._;
i18n._('Save your time and work more efficiently.');
Check out the demo on JSFiddle.

IBM Worklight 6.0 - WL.TabBar.addItem title parameter not working correctly with "null" as value

According to the documentation for WL.TabBar.addItem regarding the title parameter:
WL.TabBar.addItem(id, callback, title, options);
title Mandatory string. The title of the tab. If null is passed, no title is displayed.
However, if I pass the value null like this:
WL.TabBar.addItem("myId", function(){ ... }, null, { ... });
I get this error:
Invalid invocation of method WL.TabBar.addItem;
Invalid value 'null' (object), expected type 'string'.
And if I pass an empty string " ", I don't see the title but there's empty spacing at the bottom, below the icon.
Well, it's clearly a bug... :)
I have opened a defect. Thanks!
If what you want to do is to center-align the icon in the tab when there is no text involved, then adding the following to your Android environment's .css file will suffice:
.tabSpan {
background-position:center;
}
In addition, and if required, you can also play with the icon dimensions.

XPages - why are Dojo Filtering Select controls obligatory? Can they be customised?

I am using some Dojo Filtering Select controls on my XPage. Despite having set the required property to false, when I attempt to save the XPage document, I see the message "This value is required" in the Dojo Filtering Select control. I would like to know
1/ is it possible to make a Dojo Filtering Select control NOT obligatory?
2/ Is it possible to customize the error message which appears when the control is obligatory?
1) You get the message "This value is required" at client side validation. So, in addition to property required="false" which is responsible for server side validation only you have to set a dojoAttribute "required" to "false". Then you don't get the message anymore.
<xe:djFilteringSelect
id="djFilteringSelect1"
value="#{...}"
required="false">
<xe:this.dojoAttributes>
<xp:dojoAttribute
name="required"
value="false">
</xp:dojoAttribute>
</xe:this.dojoAttributes>
</xe:djFilteringSelect>
2) The same way you can set the dojoAttribute "missingMessage" to the string you like in case your control stays obligatory.
you can customized these parameters (They are in the parent ValidationTextBox of FilteringSelect):
// required: Boolean
// User is required to enter data into this field.
required: false,
// promptMessage: String
// If defined, display this hint string immediately on focus to the textbox, if empty.
// Also displays if the textbox value is Incomplete (not yet valid but will be with additional input).
// Think of this like a tooltip that tells the user what to do, not an error message
// that tells the user what they've done wrong.
//
// Message disappears when user starts typing.
promptMessage: "",
// invalidMessage: String
// The message to display if value is invalid.
// The translated string value is read from the message file by default.
// Set to "" to use the promptMessage instead.
invalidMessage: "$_unset_$",
// missingMessage: String
// The message to display if value is empty and the field is required.
// The translated string value is read from the message file by default.
// Set to "" to use the invalidMessage instead.
missingMessage: "$_unset_$",
// message: String
// Currently error/prompt message.
// When using the default tooltip implementation, this will only be
// displayed when the field is focused.
message: "",
If you set required to false, it should not prompt message, can you post you code.