PDA

View Full Version : LiveSearch selection



SaleCar
Jan 09, 2015, 7:47 PM
I implemented LiveSearch like example http://examples.ext.net/#/GridPanel/Plugins/LiveSearch/

There is one problem with selection.

When finishing searching and deleting characters from LiveSearch, grid selection changes, but when deleted last character (LiveSearch empty), on grid is nothing visualy selected but code says that is selected last selected record just before all characters are removed.

Its difficult to explain...

Just try example from link, when finish search, there is no row selected in grid, and SelectionChange Listener dont run!
Even DirectCast(Grid.SelectionModel.Primary, RowSelectionModel).SelectedRecordID says that there is selected row!

This is important because I want to reset values in detail form after LiveSearch but dont know how.

SaleCar
Jan 09, 2015, 8:30 PM
I solve it...



<SelectionChange Handler="if(!selected.length) {#{Form}.reset(); #{Grid}.getSelectionModel().deselectAll()};" />


Close thread, sorry for inconvenience.

SaleCar
Jan 09, 2015, 9:03 PM
Just to mention

I have SelectionChange Listener (when nothing is selected)


#{Grid}.getSelectionModel().deselectAll()

and Direct Event for loading detail data with


DirectCast(Grid.SelectionModel.Primary, RowSelectionModel).SelectedRecordID

and when emptying LiveSearch, and remove selection, direct event fires BEFORE listener and fills form data.

So, I put Delay="50" in Direct Event so Listener can deselect selectionmodel so Direct Event cannot fill it with data.

Is there better way to set Listener fire before Direct Event?

I think it would be best to LiveSearch after empty-ing leave last row selected so I not waste the hours to handle this.