ExtJS 6.5 View, how to unselect last one selected - extjs

I've got an Ext.view.View that has a list of templates rendered. When I select a row on the view, I want the previous one selected to be unselected. Currently, I have an onchange event that deselects everything (see below), but that causes problems when I have items filtered.
How can I DeSelect just the currently filtered rows. below is my unselect everything code.
Ext.Array.each(this.query('dataview'), function (v) {
v !== sm.view && v.getSelectionModel().deselectAll();
});
Want I'm wanting is to just deselect the rows that are filtered in the associated store. The problem with the above code is that when it runs, the filter gets removed and all the rows in the view show back up again.

Related

Material ui Datagrid get value on unchecking checkbox

I am using Material ui datagrid. I want to get the value on uncheck of checkbox also.
I have an API which update the Datagrid, on selection I get the selected row data which then on button click I update the value into another array of object, Now when I close the datagrid and open again I want the data to be shown in table comparing if already present in array of object mark it as selected in checkbox, Now when i deselect the checkbox i need the ID and the row data which was removed so I can update the array again, but here on deselect the checkbox it shows empty, so how I can get the removed one so I can update my array
https://codesandbox.io/s/66424752get-row-item-on-checkbox-selection-in-react-material-ui-data-grid-wp4vl?file=/demo.tsx

uigrid custom filter rows are note getting unselected

I have custom filters implemented in ui grid for multiple columns and this filtering works very fine.
Now when i do the Reset All Filter, it works functionally however rows which are selected for Filters remains selected. This is really disturbing. I want to deselect all rows in the filters as soon I click Reset All Filter but this is now happening.
Did anyone faced this problem??
Individually clearing selected rows for a single filter
...
$scope.gridPopupApi.selection.clearSelectedRows();
...
UI Grid filter example
http://ui-grid.info/docs/#!/tutorial/Tutorial:%20306%20Custom%20Filters

How to remove checkbox selection from all views in checkbox selection model in EXT grid

I have a Ext grid with checkbox selection Model. The grid contains multiple pages of 50 records each. I have a 'Clear Selections' button to deselect all the selected rows in the selection model.
The code for this is :
handler: function(){
this.selectionModel.deselectAll();
this.selectedReordsArray.clear();
},
scope: this
The problem is, when I select some records in the first page and move to second page and select some records there as well. Now if I click 'Clear Selections' button it deselects the rows on that page i.e. second page , but when I go back to page 1 , the rows there are still selected.
Is there any way to remove checkbox selections from all the pages.
Thanks,
PS : I am using Ext JS 4.1.3
Add "pruneRemoved: false" for your selmodel. Then try adding deselectAll() method for your gridstore. This will clear selected records from all pages.

Reload grid selection after deletion of row in extjs

I have a grid with one column, which when the user selects, is used to display information in various textfields, checkboxes which are embedded in a panel on the right. I have implemented a delete feature at the row level in the grid. Now I wish either of these two things to happen.
1) Either the default selection is such that the first row is by default selected after deletion of any row.
OR
2)The information in the various components in the panel on the right is cleared.
Currently what happens is that the information which corresponds to the deleted row stays after deletion since nothing is selected in the grid so the previous selected option is used to display information on the right.
As removing the record from the grid implies deselecting it, you really just need to listen for changes to the selection in your grid and implement the desired behaviour when no selection exists.
I'd recommend the selectionchange event, as you can cover both selection and deselection by inspecting the new selection state:
grid.on({
'selectionchange': function(sm, selectedRecords) {
if (selectedRecords.length === 0) {
// no selection -> clear fields or select the first row
} else {
// selection exists -> load data into fields
}
}
});
(assuming you're using single selection, i.e. either one or no row can be selected)

Extjs Grid Panel Filter - Clear filters only in one column

This question (EXTjs gridfilter: How to clearfilter without reloading store?) shows how to clear all the filters on the entire grid.
Is there a way to clear only the filters in a specific column? For example, if I have a column with a list filter that has 20 options and I select 8 of them, I'd like a button that will uncheck all of those, but leave any other filters I've selected to remain in tact.
The 'size' column on this demo is a good example of what the filtering looks like: http://dev.sencha.com/deploy/ext-4.0.0/examples/grid-filtering/grid-filter-local.html
You can do it with the setActive method of the filter.
And here's how you can get a reference to this filter:
// FiltersFeature adds a filters property to the grid it is bound to
grid.filters.getFilter('size').setActive(false)
Edit: How to uncheck all boxes
var filter = grid.filters.getFilter('size');
filter.menu.items.each(function(checkbox) {
// The second argument suppress the check event in order to prevent
// unexpected behaviour, like the filter reenabling itself and trying
// to update the store several times in a row
checkbox.setChecked(false, true);
});

Resources