Showing results for 
Search instead for 
Do you mean 

Sorting the CurrentCompanyList makes it empty

Copper Contributor
Posts: 119
Country: Netherlands

Sorting the CurrentCompanyList makes it empty

I have a very strange problem. A customer asked us to create buttons for 'Lookup selected' and 'Omit selected', for in the Company Listview.

I thought, that's easy. 


The first:


CompanyList cl = companyListView.GetSelectedCompanies();
if (cl == null) return;
Controller.Instance.actApp.ApplicationState.CurrentCompanyList = cl;


The second:


CompanyList cl_current = companyListView.GetSelectedCompanies();
if (cl_current == null) return;

List<Guid> lst_new = new List<Guid>();
foreach (Company c in Controller.Instance.actApp.ApplicationState.CurrentCompanyList)
if (cl_current.Contains(c)) continue;

CompanyList cl_new = Controller.Instance.actApp.ActFramework.Companies.GetCompaniesByID(Controller.Instance.actApp.ApplicationState.CurrentCompanyList.SortCriteria, lst_new.ToArray());
Controller.Instance.actApp.ApplicationState.CurrentCompanyList = cl_new;


This works, however, when I first sort the lookup (by hand, clicking the column header), and make a selection, and then omit a selection, the result is always empty. Even if I create the sortcriteria array myself, and even if I pass 'null' with GetCompaniesByID and Sort(sortCrits) it afterwards.


Is this a bug? I'd like to maintain the current sort column and sort order.




ACT Certified Consultants
the Netherlands