Angular-material. Autocomplete directive - autocomplete

I have some problem with autocomplete. And my question is: Can I send my own personally typed text instead object from autocomplete list?
When I send object from list to "person.eamil" it's ok, but
when I send normal text to "person.email" I get null instead my text.
Here is my HTML code:
<md-autocomplete
ng-model="person.email"
ng-disabled="false"
md-no-cache="true"
md-selected-item="person.email"
md-search-text-change="setPersonValidEmail(person, !innerForm.email.$error.email);"
md-search-text="searchText"
md-items="item in people"
md-item-text="item.email"
md-min-length="0"
placeholder="some#one.com"
ng-click="addOurPersonIfNecessary($index);"
name = "email">
<md-item-template>
<span md-highlight-text="searchText" md-highlight-flags="^i">{{item.name}}</span>
</md-item-template>
</md-autocomplete>

Md-selected-item here is expecting an object that is populated in people. Only then it can populate the auto complete. You can pass the text to md-search-text

I found solution. Try to use another autocomplete plugin like this:
https://github.com/ghiden/angucomplete-alt

Related

Sharepoint Rest Api Search query, getting a field with rich text

I am trying to get a field with a rich text but it is striping all the html in the search query. Is there a way to get the html rather than the rich text?
https://{domain}.sharepoint.com/_api/search/query?querytext=%27claim%27&selectproperties=%27Title,Question,Answer%27
<d:Key>Answer</d:Key>
<d:Value xml:space="preserve"> See THIS Form​ . ​ </d:Value>
Answer is the Rich text field with a link in it, When I do a GET (_api/web/lists/getbytitle), it comes back with a link in that field.
Basically, I want to avoid having to call search then call a GET to replace the values.
I solved this by looking through the search properties and using the ID in the path to use a GET List
_api/web/lists/getbytitle('title')/items('1')
then replacing the column in search with the rich text with the one from the GET.
I only need 3 results or so, so this was not a problem for me.
It looks like in the search query, doesnt give back any html tags for the rich text column.

org.eclipse.ui.dialogs.ListSelectionDialog input options?

i try to display a dialog for selection the fields of a source.
i like to use the ListSelectionDialog, but i'm not sure what to use for the input parameter.
all the examples in the web uses the
ResourcesPlugin.getWorkspace().getRoot()
as input and yeah, all the projects are displayed.
but i have a list of Fields (IField[]) that i want to show for selection.
the constructor of ListSelectionDialog accept the parameter, but the dialog shows nothing... :(
does anybody has an idea?
thanks a lot!
Sven
I don't think using BaseWorkbenchContentProvider is right. Try ArrayContentProvider.
So something like:
new ListSelectionDialog(shell, fields, new ArrayContentProvider(), labelProvider, msg);

Disable escape in Zend Form Element Submit

I can't disable escaping in a Zend_Form_Element_Submit, so when the label has special characters it won't display it's value..
This is my actual Zend Form piece of code:
$this->submit = new Zend_Form_Element_Submit('submit');
$this->submit->setLabel('Iniciar Sesión');
$this->submit->setIgnore(true);
$this->addElement($this->submit);
I've tried $this->submit->getDecorator('Label')->setOption('escape', false); but I obtain an "non-object" error (maybe submit isn't using the "Label" Decorator)..
I've also tried as suggested $this->submit->setAttrib('escape', false); but no text will be shown either.. Any idea? Thanks
Should be as simple as doing this:
$element->addDecorator('Label', аrray('escape'=>false));
Or see setEscape(). http://framework.zend.com/manual/1.12/en/zend.form.standardDecorators.html
Regarding failure to retrieve named decorator... Try getDecorators() Do you see 'label' in the results?
There is no Label decorator for submit form element by default (this is why you get the error).
The $this->submit->setLabel('Iniciar Sesión'); value goes to Zend_View_Helper_FormSubmit, which always does escaping and uses the label as a value.
The helper used by the Submit element escapes by default. Unlike with the label decorator, submit labels are included in a HTML attribute so they need to be escaped.
Your label - Iniciar Sesión - is a perfectly valid UTF-8 string, so the escaped version of it will be the same. If your label is not appearing then something else is going wrong. I'd guess that your page is being served using a charset that doesn't match what Zend View is using (UTF-8 by default).
View the page source to see what actually gets output - that might give you some more clues. Alternatively if the page this form is on is public, if you can provide a URL we might be able to spot the issue.
I ran into a similar issue. In my instance, I added both a label and a description to a text field element. This line of code allowed me to turn off the html escaping for the description attached to that field element:
$form->getElement('txtUPC')->getDecorator('description')->setOption('escape', false);
In my testing, the setEscape() was not recognized by the form elements or their decorators.

check if custom attribute has specific value

My problem seemed easy at first but i got stuck.
I have some containers (divs) in my page with some custom attributes.
<div class="myclass" myattr1="blah" myattr2="text1-text2-text3-text4-"></div>
myattr1 and myattr2 are defined by me.
All divs are visible on page load.
Now, depending on user selection from a list, i want to show only the divs with myattrib1="blah" and hide the rest.
I tried the following code, with no success at all
$('#mySelectID').change(function()
{
var startName = $(this).val();
$(".myclass").not('[myattrib1!="+startName+"]').toggle();
});
The same approach will be used to filter results by attrib2, but there i will use myattrib2|="+startName+" ( i think this is correct - thats why i have the extra - on the end of myattr2="text1-text2-text3-text4-").
Can anyone advice me on how to properly achieve this kind of filtering?
thank you!
You are close, but as you can see form the syntax highlighting, your are not performing string concatenation. +startName+ will be taken literally. Fix the quotes and your fine:
.not('[myattrib1!="' + startName + '"]')
Note that you should be using data-* attributes instead of custom ones.

Line breaks in Zend Navigation Menu labels

I have a need to create a <br/> tag in the display label for a menu item generated using Zend_navigation, but don't seem to be able to find a way to do so.
My navigation item is defined in the XML config as:
<registermachine>
<label>Register your Slitter Rewinder</label>
<controller>service</controller>
<action>register</action>
<route>default</route>
</registermachine>
I want to force a tag in the output HTML between 'your' and 'slitter', such that it appears on two line as below:
Register your
Slitter Rewinder
However, I can't seem to do it. obviously using in the XML breaks parsing, and using html entities means that the lable is displayed as:
Register your <br/>Slitter Rewinder
Has anyone had experience of this that can offer advice?
Thanks in advance!
there is no such option built-in you have to use a partial
$partial = array('menu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial);
echo $this->navigation()->menu()->render();
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.menu
you may also try a hack with <label><![CDATA[Menu label<br/>Second line]]></label>
I found a (hacky) solution:
I updated my navigation.xml to use {br} tokens wherever a <br/> tag is required, and then amended the base Zend/View/Helper/Navigation/Menu.php file as follows:
within htmlify function, changed
$this->view->escape($label)
to
str_replace("{br}", "<br/>", $label)
I could (and probably will) override the Zend Library Menu View Helper with my own at some point, but this at least cover it for now.
there is a escapeLabels boolean used to convert html tags and it's true by default.
You can set your navigation like this
$this->navigation()
->menu()
->escapeLabels(false)
->...
http://framework.zend.com/apidoc/2.0/classes/Zend.View.Helper.Navigation.Menu.html#escapeLabels