[英]Infragistics Ultragrid - slow performance with PerformAutoResize
I have badly performing code that uses Ultragrid, but running a visualisation analysis using D3.js on the trace output I discovered that grid__InitializeRow was calling itself multiple times. 我使用Ultragrid的代码执行得很差,但是在跟踪输出上使用D3.js运行可视化分析时,我发现grid__InitializeRow多次调用自身。
Trigger created by: this.grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.grid_InitializeRow);
触发器创建者:
this.grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.grid_InitializeRow);
Problem starts with this code: 问题从以下代码开始:
column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)
Searching the web I could not find information on this, but have found some possible contenders - calling any of these appears to call initialise row: 在网上搜索时,我找不到有关此信息,但是找到了一些可能的竞争者-调用其中任何一个似乎都会调用初始化行:
Questions 问题
Thanks in advance 提前致谢
Found the answer via Infragistics forums : 通过Infragistics论坛找到了答案:
Calling column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)
triggers a rebind from the datasource, which in turn triggers initialise_row
. 调用
column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)
会触发来自数据源的重新绑定,进而触发initialise_row
。
As the resize was called multiple times (once per column per band) the rebinds got out of hand. 由于多次调用了重新调整大小(每条带每列一次),因此重新绑定变得一发不可收拾。
For information we also had the following problems. 作为参考,我们还存在以下问题。 With a year's data it was taking 2 minutes to render:
根据一年的数据,渲染需要2分钟:
Hope this helps others with simiar problems 希望这可以帮助其他遇到类似问题的人
I couldn't make "PerformAutoResize" perform adequately. 我无法充分发挥“ PerformAutoResize”的作用。 It would take 10s of seconds.
这将需要10秒钟的时间。 So in the end I decided to roll my own, which is limited to our particular use of the grid config which only displays text in cells (as opposed to sub-controls), using the Graphics.MeasureString function for each grid cell.
因此,最终我决定自己动手,这仅限于我们对网格配置的特殊使用,该配置仅在每个网格单元中使用Graphics.MeasureString函数,从而仅在单元格(而不是子控件)中显示文本。
About 40 lines of code and reduced time taken to 0.4 secs for a 600 x 20 grid. 对于600 x 20的网格,大约需要40行代码,并将时间减少到0.4秒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.