I would like to create a simple label in the app that would show whether the gate is open or not. That is, for this I can use a boolean type that returns true/false, but I would like it to display yes/no on the page instead of true/false and add a translation in Dutch, that is, depending on how the user initially sets the language of the app, the yes/no message will be displayed in that language. In the app, I already have the other . translatedor false.
That is, half th success is. The function works. However, instead of this true/false, I would like to put yes/no in 2 language versions.
I was thinking of adding something like translations in the JSON file, for example: "true": "yes" and "false": "no" and the same in the Dutch version, because currently the value of true/false is returned automatically, however, I don't know how I could pass something like that to the code line shown above. Does anyone have an idea how I could implement this?
I recommend you to use build-in angular translator or install ngx-translate. If you use 2nd option your code will look like this:
<dd class="col-sm-6">{{gate.open ? ('gate_open' | translate) : ( 'gate_closed' | translate) }} </dd>
Ofc you have to add translation to json or ts files
Related
I'm working on a website with a feature that can sort users.
I'm using mvcgrid.net libs but I can't figure it out. the toolbar doesn't work.
I used most of the basic source codes from mvcgrid.net but when i press something in the search bar it doesn't work or the items per page selection.
If you have specific code to take a look at, please post. Otherwise, here are a few things you can check:
(1) Be sure you've applied the mvcgrid data attributes needed. For example, for a search field you might have these attributes:
<input
type="search"
data-mvcgrid-apply-additional="change"
data-mvcgrid-type="additionalQueryOption"
data-mvcgrid-option="search"
data-mvcgrid-name="ContactGrid">
(2) Be sure the value you chose for mvcgrid-option (in this example, "search") is then added when you configure the grid. For example:
MVCGridDefinitionTable.Add("ContactGrid", new MVCGridBuilder<ContactViewModel>(defaults)
.WithAdditionalQueryOptionNames("Search")
...
(3) You then need to read the attribute (again in the grid config) in your .WithRetrieveDataMethod()
string search = options.GetAdditionalQueryOptionString("search");
I've forgotten step 2 in the past -- that's generally what has tripped me up.
I have a filter I want to apply to my google analytics chart embedded in my site. I want to filter ga:pagePathLevel2 to be one of a list of numbers;
Ideally I want it to be something like
'filters' : 'ga:pagePathLevel2==/6|/7|/8',
but that doesnt work, My authorization button doesnt show up after that so apparently something doesn't work
You can use a the =~ syntax to set a regular expression filter if you want to match a URL part in several possible forms.
If your case, you could do something like:
'filters': 'ga:pagePathLevel2=~^/(6|7|8)'
On an unrelated note: if your auth button isn't showing up at all, it's almost certainly because you have a syntax error and has nothing to do with the filter syntax. If you open up the developer console, you should see the error being logged.
I have an array:
[
0 => 'translate.label1',
1 => 'translate.label2',
2 => 'translate.label1'
]
which I specify as a choices param for field creation.
Now, is it possible to sort these options by translated labels? For example, label1 translated value is zero, label2 - something, label3 - abracadabra. Of course, I expect select options to be:
abracadabra
something
zero
I thought to use this approach: https://stackoverflow.com/a/21586886/2324004
But doesn't it involve second translator digest inside view? Any ideas? I'd rather to use something more flexible because my form is based on non-fixed selects count and it would have executed something recursive...
You have to do it in js after data will be uploaded.
Check this topic:
Javascript to sort contents of select element
Due to fact the translation occurs inside Twig view, the only solution (right now I'm aware) is to prepare translated and sorted list during form build process by injecting manually TranslatorInterface service.
Unfortunately, without overriding widget's template, translation occurs second time, against already translated labels.
Using Domino Designer 8.5. If I have a form with a radio button field, is it possible to disable that field in LotusScript, possibly in the Postopen even of the form?
The only way I can, so far, see of achieving this is by using the Input Enabled formula of the field itself, but I am struggling to understand when this is triggered... if I try to put a #StatusBar or #Prompt formula call in there as well then there is never any notification of Input Enabled being triggered.
If Input Enabled is the way to achieve this, not LotusScript, then is there a way I can have a) a formula that sets the Input Enabled condition plus b) a way of getting some visual output, either to the Status Bar or a Message Box, to either just indicate the formula has been triggered or - even better - to let me know the value of some variable I'd like to check?
The Input Enabled Formula is triggered on every refresh of the document (F9, Save, NotesUIDocument.Refresh, etc.), it can not contain any code "interacting" with the user.
But you could do something like this:
Create a Field "InputEnabled"
The best way to have a "controlling" field is to make it "Computed for Display". That way it is not stored in the document. As a formula you simply enter #ThisValue, then it does not change its value by itself and can be set using LotusScript. If you want to have an "initial" value, then the formula would be: #If( #ThisValue = "" ; "YES" ; #ThisValue )
In the "Input enabled" Formula of your other field write the code:
InputEnabled = "YES"
Fill the "InputEnabled"- Field using a LotusScript (NotesDocument.ReplaceItemValue( "InputInabled", "YES" ), or using a Formula directly in the field.
Like that you can easily "see" what the conditions are (in the field InputEnabled) and change it using formula or script.
Old school way to Disabling the radio button field:
You will have to use the **Hide paragraph if formula is true". Define a field: MyButEnabled accorting to which you enable (show) or disable (hide) the field. for UI convience display a complementary line that only display the value of your radio button (you can also use a computed radio button but it's not very pretty).
In the post open set the appropriated value for the field MyButEnabled. Dont forget to call uidoc.RefreshHideFormulas method.
The notes input enabled way: (see also: http://www-01.ibm.com/support/docview.wss?uid=swg21173862)
the notes input enabled formula is (for example)
#if(MyButEnabled="Y" ; 1 ; 0)
When you form is openned, the formula is computed, if the result is 0 the field won't be editable, 1 will allow field to be edited.
If you change the value of MyButEnabled, then you need to make a UIdocument.refresh in order to change to be reflected in the UI.
This code is from a program I use to enter and track information. Numbers are entered as work orders (WO) to track clients. But one of the tables is duplicating the WO information. So I was trying to figure out a general outline of what this code is saying so that the problem can be fixed.
Here is the original line:
wc.dll?x3~emproc~datarecord~&ACTION=DISPLAY&TABLE+WORK&KEYVALUE=<%work.wo%&KEYFIELD=WO
What I think I understand of it so far, and I could be very wrong, is:
wc.dll?x3~emproc~datarecord~&ACTION
//No clue because don't know ~ means or using & (connects?Action)
=DISPLAY&TABLE+WORK&KEYVALUE
//Display of contents(what makes it pretty) and the value inside the table at that slot
=<work.wo%&KEYFIELD
//Calling the work from the WO object
=WO
//is Assigning whatever was placed into the WO field into the left side of the statement
I'll do my best to interpret the statement, with the limited information you've provided:
wc.dll is an instruction to invoke a DLL
? is introducing a list of parameters (like a query string in HTTP)
x3~emproc~datarecord~ seems like a reference to a function in the dll
& parameter separator
ACTION=DISPLAY set the ACTION parameter to the value DISPLAY
TABLE+WORK perhaps sets a couple of flags
KEYVALUE=<%work.wo% set the KEYVALUE parameter to the value of <%work.wo%
KEYFIELD=WO set the KEYFIELD parameter to the value WO
Hope that helps.