Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

LMDGrid: sorting issue

I fill a LMDGrid table using a method that first deletes all data rows and then adds a new datarow for each data record to be shown. This works fine.

Then I sort the table in an ascending order by clicking on a column header. When I modify a data record in a separate window (not in the LMDGrid) and call my method to show the modified data, most of the rows are empty, only the last data row contains data.

When I sort the table in an descending order all data rows are shown, but the columns with higher column idx than the sorted column are not filled with data completely.

The reason for that behavior might be the activated sorting. Therefore I tried to deactivate the sorting by setting sort kind to Lmdgrid::skNone for each column before adding data. But this does not have an effect.

How can I solve this issue?   

Code snippet of my method:

********************************************** 

 tbRegistrations->BeginUpdate();

 //deactivae sorting (does not help...)
 tbRegistrations->Columns->Items[0]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[1]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[2]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[3]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[4]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[5]->SortKind=Lmdgrid::skNone;
 tbRegistrations->Columns->Items[6]->SortKind=Lmdgrid::skNone;

 try {
  for (int i=tbRegistrations->DataRowCount-1; i>=0; i--) {
   tbRegistrations->DeleteDataRow(i);
  }

  FRegistrationList=dmMain->fbvTournament->getList(ltRegistration);
  for (int i=0; i<FRegistrationList->Count; i++) {
   TFBVRegistrationObject *obj=(TFBVRegistrationObject*)FRegistrationList->Items[i];
   TFBVRegistrationData data=obj->getData();
   //get data from object
   fbvRegistration->readFromObject(obj);
   //write data to grid
   tbRegistrations->DataRowCount++;
   int rowidx=tbRegistrations->DataRowCount-1;
   tbRegistrations->Cells[0][rowidx]=GUIDToString(fbvRegistration->getGUID());
   tbRegistrations->Cells[1][rowidx]=getCountryText(fbvRegistration->State);
   tbRegistrations->Cells[2][rowidx]=fbvRegistration->CenterName;
   tbRegistrations->Cells[3][rowidx]=getRegistrationGroupText(fbvRegistration->Registrationtype);
   tbRegistrations->Cells[4][rowidx]=fbvRegistration->RegistrationGroup;
   tbRegistrations->Cells[5][rowidx]=IntToStr(fbvRegistration->StartNumber);
   tbRegistrations->Cells[6][rowidx]=fbvRegistration->RegistrationName;
  }
 }
 __finally {
  tbRegistrations->EndUpdate();
 }

Comments

Sign In or Register to comment.