ParentRowIndex vs SortRows

  • babe59 6 days, 12 hours ago

    Hello,

    FarPoint.Win.Spread, Version=8.35.20151.0

    I use a hierarchical grid. After loading data, I use

    grdErrorMessage.Sheets[0].SortRows(1, true, false)

    to sort row.
    After that the parentRowIndex is not good.
    It’s the same if I sort row by clicking on column header

    ex :
    Befort Sort
    Row C
    Row C.1 (parentRowIndex = 0)
    Row C.2 (parentRowIndex = 0)
    RowA
    Row A.1(parentRowIndex = 1)
    Row A.2 (parentRowIndex = 1)
    RowB
    Row B.1 (parentRowIndex = 2)
    Row B.2 (parentRowIndex = 2)

    After Sort
    RowA
    Row A.1(parentRowIndex = 1)
    Row A.2 (parentRowIndex = 1)
    RowB
    Row B.1 (parentRowIndex = 2)
    Row B.2 (parentRowIndex = 2)
    Row C
    Row C.1 (parentRowIndex = 0)
    Row C.2 (parentRowIndex = 0)

    I do that because I search wich row are selected (on a child or on a main) and if row selected on a child, I would like to know parent row index…

    here my code

    SpreadView spreadView = grid.GetRootWorkbook().GetActiveWorkbook();
    SheetView sheet = spreadView.GetSheetView();
    parentRowIndex = sheet.ParentRowIndex;
    
    CellRange[] cellRanges = grid.ActiveSheet.GetChildView(parentRowIndex, 0).GetSelections();

    Then if I select RowC.1 (after sort)
    cellRanges is anpty and parentRowIndex is set to 0

    thks

  • 11p
    Kevin Ashley11p 6 days, 5 hours ago

    Hello,

    Would it be possible to please provide a small sample application that shows the issue so I can investigate it further?

    Regards,
    Kevin

  • babe59 2 days, 10 hours ago

    Hello
    Here a sample project in attached file

    1° click on “Load” button
    2° expand all line
    3° Click on parent line number 3 (message at the bottom “Parent : Ligne : 2″) => OK
    4° Click on on first line of the child view of line number 3 (pk=7) (message at the bottom “Child : parentRowIndex =2 Ligne :0″) => Ok
    5° Click on “Sort Desc” button
    line 3 goes to line 1
    6° Click on on first line of the child view of line number 1 (pk=7) (message at the bottom “Child : parentRowIndex =2 Pa de ligne) => No Ok

    the parent rowIndex stay at value 2 while it is now in first position (index = 0)

    Attachments:
    You must be logged in to view attched files.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to create new topics.