Finding the model location from a cell location with grouping enabled

Posted by: crmfusiongw on 8 September 2017, 2:40 pm EST

  • Posted 8 September 2017, 2:40 pm EST

    I have been using GetModelRowFromViewRow method to access the row in the bound datatable given a row in the grid.  The problem is that when I turn on grouping this valid is no longer valid.

     How can I find the model row and column given a view row and column if grouping is enabled?

     

    Regards;

    GlennW

  • Replied 8 September 2017, 2:40 pm EST

    Hello,

    GetModelRowFromViewRow is not returning the correct index once the grouping has been applied. I have reported it as a bug in Spread and the bug number for the same is #99922428, it will be fixed in future maintenance build of Spread 5.

    Thanks.

  • Replied 8 September 2017, 2:40 pm EST

    Do you have and ETA on when the fix would be available?

     

    Regards;

    GlennW

  • Replied 8 September 2017, 2:40 pm EST

    The SheetView's GetModelRowFromViewRow method is working as intended.

    When sheet is not grouped, SheetView has a reference to a DefaultSheetDataModel.  The SheetView's GetModelRowFromViewRow method maps a SheetView row index to a DefaultSheetDataModel row index.  For example...

    int viewRow = fpSpread1.Sheets[0].ActiveRowIndex;
    int modelRow = fpSpread1.Sheets[0].GetModelRowFromViewRow(viewRow);

    When sheet is grouped, SheetView has a reference to a GroupDataModel which has a reference to a DefaultSheetDataModel.  The SheetView's GetModelRowFromViewRow method maps a SheetView row index to a GroupDataModel row index.  The GroupDataModel's GetIndex method maps a GroupDataModel row index to a DefaultSheetDataModel row index.  For example...

    GroupDataModel groupModel = (GroupDataModel)fpSpread1.Sheets[0].Models.Data;
    int viewRow = fpSpread1.Sheets[0].ActiveRowIndex;
    int groupModelRow = fpSpread1.Sheets[0].GetModelRowFromViewRow(viewRow);
    int defaultModelRow = groupModel.GetIndex(groupModelRow);

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels