Home > Back-end > Delphi data list control (ListView, DBGrid) follow-up questions
Delphi data list control (ListView, DBGrid) follow-up questions
Time:09-15
The problem of the last post, continue to study, hope to answer a great godhttps://bbs.csdn.net/topics/392406195
Contrast the ListView and DBGrid directly write data rate (60 3000 data, each data field) DBGrid: Append, FieldByName writing takes more than 2 seconds, ListView: SubItems. Add writing takes more than 4 seconds Light so see DBGrid appeared to be slightly better But ListView has a OwnerData property, after open OnData method is used to refresh the data of the time only 0.02 seconds
So the question is coming, whether the DBGrid have ListView this mechanism, brush out data are not considered part of the screen, scroll down to brush out If any want to how to implement, best can put a simple code, of course, don't use click the next Page this way, such as the Page Down need like ListView display a Page, scroll Down natural brush out
CodePudding user response:
One could argue, since refresh the ListView control efficiency is high, so why idle egg pain I also want to change ListView to DBGrid And controls a change, the interface associated with this control code to rewrite all, time-consuming effort There are two main reasons, 1, DBGrid controls may be increased to a field data types not ListView, and practice requires more data types to determine left to align right alignment, or other effects, ListView can only each field to adjust manually, too much trouble, at present already has more than 60 field, happen to the back with the increase of demand field continues to become more, maintain too tired 2, sorting, now before the OnData refresh data, first to a Tlist data using a Sort Sort, time consuming, peak interface may be directly stuck (the interface data real-time demand is very high, if monitoring 3000 customers, real-time advocate refresh, peak may refresh rate) hundreds of thousands of times per second, and DBGrid is ordered to by adding the index field, efficiency is much faster,
CodePudding user response:
I this case can set a packetRecords ClientDataSet? But packetRecords I enter an item number, or not do, don't know how to use
CodePudding user response:
FetchOnDemand set to True, packetRecords set up 50, but the brush
CodePudding user response:
The last time is not already solved the DBGrid performance issues? Was 3000 rows and three columns of data, it only took 0.012 seconds, I had a test today, even 60 columns, also only 0.25 seconds, your computer or network is slow?
CodePudding user response:
If you take Firedac Delphi, use TFDMemTable instead of the TClientDataSet, 60 listed 3000 rows of data only 0.12 seconds to complete