To much time to load data To farPoint Grid

Posted by: michal-fp on 8 September 2017, 2:04 pm EST

  • Posted 8 September 2017, 2:04 pm EST

    Hi,


    I use FarPoint grid with combo and autoComplate cells.


    when I try to load a few records it's works great but when I try to load 500 or more records it take a lot of time.


    what I do is :


    initialize the grid with combo or auto complete according to the following code (for combo exp)  :


     


    string[] ColumnDataString = new string[ColumnDataSource.Rows.Count];


    string[] ColumnDataCodes = new string[ColumnDataSource.Rows.Count];


    for (int row = 0; row < ColumnDataSource.Rows.Count; row++)


    {


    ColumnDataString[row] = ColumnDataSource.Rows[row][1].ToString().Trim();


    ColumnDataCodes[row] = ColumnDataSource.Rows[row][0].ToString().Trim();


    }


    AutoCompleteStringCollection AutoCompleteStringCollection = new AutoCompleteStringCollection();


    AutoCompleteStringCollection.AddRange(ColumnDataString);


    //Create the cell type


    FarPoint.Win.Spread.CellType.ComboBoxCellType ComboBoxCellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();


    ComboBoxCellType.AutoCompleteSource = AutoCompleteSource.CustomSource;


    ComboBoxCellType.AutoCompleteCustomSource = AutoCompleteStringCollection;


    ComboBoxCellType.Items = ColumnDataString;


    ComboBoxCellType.ItemData = ColumnDataCodes;


    ComboBoxCellType.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData;


    ComboBoxCellType.AutoFillAutoCompleteCustomSource = true;


    ComboBoxCellType.AutoCompleteMode = AutoCompleteMode.SuggestAppend;


    ComboBoxCellType.AutoSearch = FarPoint.Win.AutoSearch.MultipleCharacter;


    FarPointGrid.ActiveSheet.Columns[ColumnFilter].CellType = ComboBoxCellType;


     


    then I clear all the grid tags (cell by cell)


    then I use SuspendLayout function and I set AutoCalculation = false


    then I fill the data from DataTable cell by cell (I need to do so in this way)


    then I use Refresh function


    and add formulas to some cells


    then I set the Autocalclation to true and I use recalculate function (both of them take a lot of time)


    and the I use Resumelayout function with true value


    do you have any suggestion how I can make things go faster ?


    TIA


    Michal


     



     

  • Replied 8 September 2017, 2:04 pm EST

    Michal,

    You are already using few of the techniques to improve the performance like using Suspend & Resume layouts and AutoCalculation to false.If you are not using sticky notes, then you can set AutoUpdateNotes to false to
    prevent the component from checking for sticky notes that need to be made
    visible or hidden or moved.If you are using AllowCellOverflow, turning that off increases the performance of the layout calculations, because that feature requires lots of text width calculations on each change to the data in a cell.

    If you are using formulas, setting AutoCalculation to false before your updates and then setting it back to true and calling Recalculate afterwards eliminates redundant intermediate recalculations of your formulas.Some other things you could do would be to reduce the size of the control or
    show fewer columns and rows at once.

    Thanks

  • Replied 8 September 2017, 2:04 pm EST

    Michal,


    In addition to what Suresh stated, the ToString and Trim methods are very performance expensive and would cause a lot of the reason for the delay you are seeing.

Need extra support?

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

Learn More

Forum Channels