This is a migrated thread and some comments may be shown as answers.

How to get rows that are visible

2 Answers 86 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Allen
Top achievements
Rank 1
Allen asked on 03 Oct 2014, 07:43 PM
I have a button that when the user clicks it will save the data from RadSpreadsheet into a DataTable.  I need to know how to loop through only the rows of the worksheet that are visible.  For example, the user starts with 200 rows and applies a data filter to get it down to only 20 rows.

2 Answers, 1 is accepted

Sort by
0
Allen
Top achievements
Rank 1
answered on 07 Oct 2014, 11:54 AM
I figured out a solution.  

        private Boolean IsRowVisible(int row, int colCount, Worksheet ws)
        {
            Boolean retValue = true;
            for (int col = 0; col < colCount; col++)
            {
                IFilter filter = ws.Filter.GetFilter(col);
                if (filter != null)
                {
                    CellSelection objSelection = ws.Cells[row, col];
                    if (!filter.ShouldShowValue(objSelection.GetValue().Value))
                    {
                        retValue = false;
                    }
                }
            }
            return retValue;
        }

0
Anna
Telerik team
answered on 08 Oct 2014, 10:09 AM
Hi Allen,

I would just like to confirm that your solution is what I would recommend as well. It follows correctly the logic the filtering feature uses to hide the necessary rows.

On a side note, while the hidden rows and columns feature is still not available, there is an item logged for it in our feedback portal, where its progress can be tracked.

Regards,
Anna
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Spreadsheet
Asked by
Allen
Top achievements
Rank 1
Answers by
Allen
Top achievements
Rank 1
Anna
Telerik team
Share this question
or