how to add search bar in ag grid dropdown - ag-grid

without a search bar, I am facing the issue it taking more time to search the required field from the dropdown
please tell me how to add a search bar in the ag-grid dropdown (angular )

You can define per column what type of filter you want to use - in your case you'll want to use 'agTextColumnFilter':
columnDefs: [
{
field: 'yourfield',
filter: 'agTextColumnFilter',
...
}

Related

How to hide fields in backpack

Is there a proper way of hiding fields in backpack? Using the hidden attr or display:none doesn't hide the label.
There are a couple solutions: modify every field view or hide it with js. Both have disadvantages.
There is no proper way to do it in backpack.
Once I needed to show and hide some fields according to a drop-down selection, here is the function I created:
const fieldVisibility = (field, visibility = true) =>
document.querySelector(`[name*="${field}"]`).closest('.form-group').style.display =
visibility ? 'block' : 'none';
Examples:
fieldVisibility('name', true) // Shows the field name
fieldVisibility('users', false) // Hides the field users[]

Accordion dropdown filtering through ion search bar

Hi I just created the ionic accordion dropdowns by following a tutorial blog link which used widgets for creating an accordion dropdowns, Below is the link of that blog.
http://masteringionic.com/blog/2019-01-27-creating-a-simple-accordion-widget-in-ionic-4/
updated: here is the my project demo link https://stackblitz.com/github/dSaif/search-accordion
Everything is working perfect, but i want to add Ion-searchbar at the top of the accordions sothat the dropdowns gets filter by inputing text.
please assist me how can i do that. Thank you.
You are going to have to create a variable in your homepage to store your filtered results. Then you need to have a filter function that will take the input from the search bar and filter your master list. Keep in mind you should not set the new variable to the master list, this could cause issues due to object referencing.
So you should have something like
in your html
<ion-searchbar placeholder="Search a name." [(ngModel)]="searchValue" (ionChange)="filterList()"></ion-searchbar>
In your ts file
searchValue: string = '';
filteredList: Array<{ name: string, description: string, image: string }> = this.technologies;
// function called in the html whenever you change the ion searchbar value
private filterList(){
//Make a variable so as to avoid any flashing on the screen if you set it to an empty array
const localFilteredList = []
this.technologies.forEach(currentItem => {
//here goes your search criteria, in the if statement
if(currentItem.name && currentItem.name.toLowerCase().includes(this.searchValue.toLowerCase())) {
localFilteredList.push(currentItem);
}
});
//finally set the global filter list to your newly filtered list
this.filteredList = localFilteredList;
}
You also need to make sure to reference the filterList variable instead of the current one you are referencing.

Hide columns on button click in ag-grid?

I need hide VAD group columns on button click. Please help me.
You can use Column API methods:
setColumnVisible(colKey, visible) Sets the visibility of a column. Key can be the column id or Column object.
or
setColumnsVisible(colKeys, visible) Same as setColumnVisible, but provide a list of column keys.
hide(){
this.gridColumnApi.setColumnsVisible(['columnNameOne', 'columnNameTwo'], false);
}
show(){
this.gridColumnApi.setColumnsVisible(['columnNameOne', 'columnNameTwo'], true);
}
Demo

Algolia autocomplete js with select2

I am using aloglia autocomplete.js and followed the tutorial.
I want to use autocomplete text box with others select2 selectbox.
var client = algoliasearch('YourApplicationID','YourSearchOnlyAPIKey')
var index = client.initIndex('YourIndex');
autocomplete('#search-input', { hint: false }, [
{
source: autocomplete.sources.hits(index, { hitsPerPage: 5 }),
displayKey: 'my_attribute',
templates: {
suggestion: function(suggestion) {
return suggestion._highlightResult.my_attribute.value;
}
}
}
]).on('autocomplete:selected', function(event, suggestion, dataset) {
console.log(suggestion, dataset);
$("#search-input").val(suggestion.full_name.name)
});
Problem is when I clicked anywhere beside that autocomplete box autocomplete disappear and it showed only what I typed before.
I don't want it to disappear. How can I implement it? Thanks for helping.
Please see the example below for detail problem.
Assume you have a simple form with one auto complete input field,two select2 boxes and one submit button. After you choose auto complete filed, when you click anywhere, it changed to default text. I mean, you put "piz" and it shows "pizza". Therefore you select pizza and it display "pizza".Then, you try to choose one select2 box or click anywhere. The autocomplete input field changed back to "piz".
I tried autocomplete:closed , $("#search-input").focusout to set the input field but it just changed back to my query.
To prevent it from disappearing, you can use autocomplete.js's debug option:
autocomplete('#search-input', { hint: false, debug: true }, [ /* ... */ ]);
The complete options list is available on GitHub.
Now I have it. When you need to only select and not to do any action, you can safety remove autocomplete:selected. And make sure your display key is value not object.
It saves me for trouble.

GWT DataGrid specific row needs add style

is anyone have idea ,how to add specific style to GWT Datagrid?
I need to add style to specific row ( class="error") to show that row in red color.
More details:
Rendering the table using the GWT Datagrid. it has column called "type" .
the type can have different values like " connected" ,"disconnected" ,"error".
if the type is error then i need to render row with different style( need to show text in the
red color).
There's RowStyles for that exact purpose.
grid.setRowStyles(new RowStyles<Row>() {
#Override
public String getStyleNames(Row row, int rowIndex) {
return "error".equals(row.getType()) ? "error" : "";
}
});