The first example above didn't have any editing, so there was no concern for expiring the value cache. Assuming your framework allows binding properties and this is what you are using.Even scrolling and opening / closing the groups does not result in the value getter getting executed again. Even through the value getter result is used in two places (aggregation and rendering the row), the value getter is only called once. Notice in the console that the value getter gets executed exactly 100 times, once for each row. The grid gets reset and then works with the value cache on. Now turn the value cache on by selecting the radio button at the top.As you open and close groups, the value getters are executed, as the DOM needs values for rendering.As you scroll up and down the grid, the value getters are executed, as the DOM needs values for rendering.The DOM requires each value that is displayed (because of scrolling, not all are displayed).The aggregation requires each value for the group total.When the grid is initially loaded, the value getter is called over 100 times.From the example, the following can be noted: So it is best to open this example in a new tab and open up the development console. This will allow us to see exactly when the value getter is called. The column on the right has a value getter Example: Value Cacheīelow shows a grid demonstrating the value cache. New records, giving an almost seamless experience to the user. Then when delta changes came in, the value getters were only executed on the Introducing the value cache meant the value getters were execute once when the initial data was loaded, so Stall for around 1,000ms as rows were added. Recomputed the aggregations, resulting in all the value getters getting called again, causing the grid to This meant, if more rows were added, the grid The client was also groupingĪnd the summing by the columns containing the value getters. Maths, using third-party maths API in the valueGetter for 8 of the columns. One client of AG Grid had 1,000 rows and 20 columns in a grid. This value cache is for advanced users who have time-consuming value getters and want to speed up their applications by introducing a cache to reduce the number of times value getters get executed. If the data in the grid has not changed since the last time the value getter was used, then the value is retrieved from the cache instead of executing the value getter again. When the value cache is turned on, each time a value getter is executed, its result is stored in the value cache. If this is the case, then you can opt to turn on the value cache to store the results of the value getters. However sometimes you might implement time-intensive tasks in your value getters. For most use cases, this will not be an issue, as value getters will execute quickly and not have any noticeable performance implications for your application. If you are not using value getters, then you do not need the value cache.Įach time the grid requires a value from a value getter, the value getter is executed. The value cache is used for the results of value getters. Column 'Const' returns back the same value for each column.Column 'Chain' takes the value 'A+B' and works on it further, thus chaining value getters.Column 'Random' doesn't take any value from the data, rather it returns a random value.Column 'A * 1000' multiplies A by 1000.Column '#' prints the row number, taken from the Row Node.Value Getters are used in all subsequent columns as follows: The following can be noted from the demo:Ĭolumns A and B are simple columns using field The example below demonstrates valueGetter. To an aggregation function when grouping, or can be used as input to another valueGetter via the Value will be used to display the cell value, however it can additionally be used to provide values ValueGetter once during a redraw, even though the value may be used multiple times. This is important as the grid will only call your That means, given the same state of yourĭata, it should consistently return the same result.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |