Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1025
How to move nested DataRecord up one position under parent record.
posted

How can move a DataRecord up one position (current index - 1) under a parent record? I have the following method that move records up to the next parent, but what I really want is to just move the record up under it's current parent if it has other sibling records before it.

private void MoveUp(object sender, RoutedEventArgs e)

{

if (theDataGrid.SelectedItems.Records.Count > 0)

{

DataRecord dr = theDataGrid.SelectedItems.Records[0] as DataRecord;

if (dr != null)

{

if (dr.ParentDataRecord.ParentDataRecord != null)

{

theDataGrid.ExecuteCommand(
DataPresenterCommands.StartEditMode);

dr.Cells["parent_id"].Value = dr.ParentDataRecord.ParentDataRecord.Cells["product_structure_id"].Value;

theDataGrid.ExecuteCommand(DataPresenterCommands.EndEditModeAndAcceptChanges);

dr.Update();

}

}

}

}

Parents
  • 8576
    Offline posted
    Hi Rod -
     
    There is no way to manually change the order of the records in the ViewableRecordCollection.  The only way I can think to accomplish this would be to:
    • have a Field in each record that represents its 'sort order' within its parent
    • add sort criteria to sort by that Field
    • when you want to move a record, change it's sort order so that it falls in the desired slot
    Joe
     
     
Reply Children
No Data