Multiselection of grid items
The main idea is easy:
- DataGrid Layout Item must have 'AllowMultiselect' property or something like this;
- ScreenObject must provide 'SelectedItems' property to get access to collection of selected item from code.
By the way, here is my temporary solution to solve this problem:
public partial class SearchCustomers
{
private DataGrid grid;
partial void SearchCustomers_Created()
{
// Write your code here.
var dgControl = this.FindControl("grid");
dgControl.ControlAvailable += new EventHandler<ControlAvailableEventArgs>(dgControl_ControlAvailable);
}
void dgControl_ControlAvailable(object sender, ControlAvailableEventArgs e)
{
grid = e.Control as DataGrid;
if (grid != null)
{
grid.SelectionMode = DataGridSelectionMode.Extended;
grid.SelectionChanged += new SelectionChangedEventHandler(grid_SelectionChanged);
}
}
void grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.SelectedCount = grid.SelectedItems.Count;
}
}
You need to override <Screen>_Created() method to get DataGrid object and then access to it for you needs. Don't forget that you must also override Delete method to delete all selected items in grid not just first selected.
1 comment
-
eunseok
commented
this feature is highly required for business app in practice.