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

    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">Hi,<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">I use FarPoint grid with combo and autoComplate cells.<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">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.<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">what I do is :<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">initialize the grid with combo or auto complete according to the following code (for combo exp)  :<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';"> <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Arial','sans-serif';">string</SPAN><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">[] ColumnDataString = <SPAN style="COLOR:blue;">new</SPAN> <SPAN style="COLOR:blue;">string</SPAN>[ColumnDataSource.Rows.Count];<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Arial','sans-serif';">string</SPAN><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">[] ColumnDataCodes = <SPAN style="COLOR:blue;">new</SPAN> <SPAN style="COLOR:blue;">string</SPAN>[ColumnDataSource.Rows.Count];<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Arial','sans-serif';">for</SPAN><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';"> (<SPAN style="COLOR:blue;">int</SPAN> row = 0; row < ColumnDataSource.Rows.Count; row++)<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">{<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ColumnDataString[row] = ColumnDataSource.Rows[row][1].ToString().Trim();<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ColumnDataCodes[row] = ColumnDataSource.Rows[row][0].ToString().Trim();<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">}<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:#2b91af;FONT-FAMILY:'Arial','sans-serif';">AutoCompleteStringCollection</SPAN><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';"> AutoCompleteStringCollection = <SPAN style="COLOR:blue;">new</SPAN> <SPAN style="COLOR:#2b91af;">AutoCompleteStringCollection</SPAN>();<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">AutoCompleteStringCollection.AddRange(ColumnDataString);<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Arial','sans-serif';">//Create the cell type<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">FarPoint.Win.Spread.CellType.<SPAN style="COLOR:#2b91af;">ComboBoxCellType</SPAN> ComboBoxCellType = <SPAN style="COLOR:blue;">new</SPAN> FarPoint.Win.Spread.CellType.<SPAN style="COLOR:#2b91af;">ComboBoxCellType</SPAN>();<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.AutoCompleteSource = <SPAN style="COLOR:#2b91af;">AutoCompleteSource</SPAN>.CustomSource;<SPAN style="COLOR:green;"><o:p></o:p></SPAN></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.AutoCompleteCustomSource = AutoCompleteStringCollection;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.Items = ColumnDataString;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.ItemData = ColumnDataCodes;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.EditorValue = FarPoint.Win.Spread.CellType.<SPAN style="COLOR:#2b91af;">EditorValue</SPAN>.ItemData;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.AutoFillAutoCompleteCustomSource = <SPAN style="COLOR:blue;">true</SPAN>;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.AutoCompleteMode = <SPAN style="COLOR:#2b91af;">AutoCompleteMode</SPAN>.SuggestAppend;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">ComboBoxCellType.AutoSearch = FarPoint.Win.<SPAN style="COLOR:#2b91af;">AutoSearch</SPAN>.MultipleCharacter;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Arial','sans-serif';">FarPointGrid</SPAN><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">.ActiveSheet.Columns[ColumnFilter].CellType = ComboBoxCellType;<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';"> <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">then I clear all the grid tags (cell by cell)<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">then I use SuspendLayout function and I set AutoCalculation = <SPAN style="COLOR:blue;">false </SPAN><o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">then I fill the data from DataTable cell by cell (I need to do so in this way)<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">then I use Refresh function <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">and add formulas to some cells <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">then I set the Autocalclation to true and I use recalculate function (both of them take a lot of time) <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">and the I use Resumelayout function with true value <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">do you have any suggestion how I can make things go faster ?<o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">TIA <o:p></o:p></SPAN></P>
    <P><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';">Michal <o:p></o:p></SPAN></P>
    <P class=MsoNormal style="MARGIN:0in 0in 0pt;"><o:p><FONT face=Calibri size=3> </FONT></o:p></P>
    <P class=MsoNormal style="MARGIN:0in 0in 0pt;"><A href="mailto:Michal.Levi@lsdco.com"><SPAN><B><SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Arial','sans-serif';mso-fareast-font-family:'Times New Roman';mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:'Times New Roman';mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-no-proof:yes;"></SPAN></B></SPAN><SPAN></SPAN></A><SPAN><B><SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Arial','sans-serif';mso-fareast-font-family:'Times New Roman';mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:'Times New Roman';mso-bidi-theme-font:minor-bidi;mso-no-proof:yes;"><o:p></o:p></SPAN></B></SPAN></P><SPAN><SPAN style="mso-fareast-font-family:'Times New Roman';mso-fareast-theme-font:minor-fareast;mso-no-proof:yes;"></SPAN></SPAN><SPAN><SPAN style="mso-fareast-font-family:'Times New Roman';mso-fareast-theme-font:minor-fareast;mso-bidi-font-family:'Times New Roman';mso-no-proof:yes;"><o:p></o:p></SPAN></SPAN><SPAN></SPAN>
    <P class=MsoNormal style="MARGIN:0in 0in 0pt;"><o:p><FONT face=Calibri size=3> </FONT></o:p></P>
  • Replied 8 September 2017, 2:04 pm EST

    <p>Michal,</p><p>You are already using few of the techniques to improve the performance like using Suspend & Resume layouts and <span style="font-size:10pt;font-family:'Arial','sans-serif';">AutoCalculation </span>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.</p><p> 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. </p><p>Thanks<br></p>
  • Replied 8 September 2017, 2:04 pm EST

    <P>Michal,</P>
    <P>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.</P>
Need extra support?

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

Learn More

Forum Channels