PrimeNG multiSelect options not getting updated with new values - primeng

Initially multiSelect is filled with 100 values, if the search string is not listed in the initial list then server side search is implemented on enter event.
<p-multiSelect [options]="options" class="multi-select-dropdown" [maxSelectedLabels]="0" resetFilterOnHide="true" [(ngModel)]="selectedValues" (onChange)="onChange($event)" (keyup.enter)="onSearchFilter($event)" [defaultLabel]="placeholder" [virtualScroll]="true" itemSize="25" [style]="{'min-width':'100%', 'max-width':'100%'}"></p-multiSelect>
Issue:
When user search for string like 'W101', if it's not available in the list then in the multiSelect "No results found" displayed".
When user hits enter, the filtered result is fetched but multiSelect is not getting updated with new values. It still shows "No results found".
But if I click the close icon(x) beside the search-box and open the drop-down then it displays the filtered list.
PrimeNG v12 is used.

Related

Algolia Autocomplete and display in result page on enter key or submit

I am looking for a solution with Algolia in React. I have a search bar where I am using autocomplete feature to load the result of products . Now when i click on submit button or Enter key i want to redirect to new result page where i want to display all the products with the available filters. As i seen most places it is using instantSearch where result loads on typing. Im looking for separate result page with filters and apply filter within the result page.

unable to reset the af:query panel search fields after page navigation

I've created a search page using default Named Criteria. I'm able to search and reset the search fields while being on the page. If I navigate to another page without clearing the search fields, the previous values are getting stored in the fields and unable to clear the fields with the reset button.
<af:query id="qryId1" headerText="Search" disclosed="true"
value="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
model="#{bindings.ImplicitViewCriteriaQuery.queryModel}"
queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}"
queryOperationListener="#{bindings.ImplicitViewCriteriaQuery.processQueryOperation}"
resultComponentId="::resId1" rows="2" maxColumns="3"
runQueryAutomatically="searchDependent"
saveResultsLayout="never" clientComponent="false"
contentDelivery="immediate" immediate="true"/>

Ionic2 and Angular2 data binding using $event.target.value

I have a requirement to open a modal on click of input box. Modal contains list of countries with search bar, once modal is open it searches for text picked from input and shows filtered list. Now user can search for different country and select from filtered list, modal closes and value is added to input field. In code,
openCountryPickerModal($event) {
let modal = this.modalCtrl.create(CountryCodePickerComponent, {"searchValue":$event.target.value});
modal.onDidDismiss(data => {
if(data){
$event.target.value=data.countrySelected;
// Here: the value set to $event.target.value is not updating to input box's model emergencyContactInfo.currentPersonalAddress.country
}
});
modal.present();
}
and in template
<ion-input (click)="openCountryPickerModal($event)" [(ngModel)]="emergencyContactInfo.currentPersonalAddress.country" type="text" placeholder="Country" readonly></ion-input>
Now the problem is, though it appears value is changed in UI, but never updates value to model. Any special reason?
I tried many ways to solve this but nothing works and I appreciate help if any.

Issue with Nested List when data does not contain 'text' node

I want to render Nested list such that when I drill down back button shows name of parent node. I tried it but looks like if the JSON I am getting doesn't have node with name text, it won't work.
Here is the fiddle with local data (in my app I am using store to fetch this from service so I don't have control over name of nodes)
Please note back button where title is not populated when you go down the tree.
There is this displayField config of NestedList where you can specify which field to be used to set title and item text . By default it is set to text but you can specify it to be one of your model field.
Here's working fiddle based on your example. Only change is in config of NestedList at bottom.
But, if you are overriding getItemTextTpl or getTitleTextTpl, this config will be ignored.

dropdown list atk4 quicksearch

i try to populate a dropdown menu for quicksearch in mvcgrid my code is:
$g = $this->add('MVCGrid');
$g->setModel('materiale');
$g->addPaginator(25);
$s = $g->addQuickSearch(array('nome_mat'));
$value_list = array(
1=>'Granito',
2=>'Marmo'
);
$s->addField('dropdown','tipo_mat','Tipo_mat: ')->setValueList($value_list);
The dropdown list appear on quick search form.
My db field is tipo_mat, but when i click quicksearch button nothing uppens, can someone help me plase.
Thank's
You will find that the Quicksearch is nothing more that a simple form, which applies condition to your grid when submitted. In theory, you could have a standard form sitting in there doing the same thing:
$search = $g->add('Form',null,'quick_search',array('form/quicksearch','form'));
$search->addFiled('dropdown','tipo_mat')
->setValueList($value_list)
->set($_GET['tipo_mat']);
$search->addField('search','q')
->set($_GET['q']);
// Handle submit of form, reload grid with AjAX, pass values as arguments
if($search->isSubmitted()){
$grid->js()->reload($search->getAllData())->execute();
}
// If values are passed, use them
if($_GET['q'])
$grid->dq->where('name like','%'.$_GET['q'].'%');
if($_GET['tipo_mat'])
$grid->dq->where('foo',$_GET['tipo_mat']);
The "Filter" and "QuickSearch" classes help you with saving search values but you must not be afraid to look into their source and create your own QuickSearch class which can apply parameters properly.
Perhaps using Filter in your case is better than quick search, because of how "applyDQ" is handled:
https://github.com/atk4/atk4/blob/master/lib/Filter.php#L62

Resources