Extending Ext.NET controls is immensely powerful and flexible. Over time you can build solid applications with reusable components very easily.
However, there are times where you need reusable snippets of code that augment your components (or the existing Ext.NET ones) without needing to subclass them.
JavaScript is a very dynamic language, meaning you could even write parts of a class or plugin that can be added to components that are unrelated to each other.
Consider our FinancialGrid
component. We might want to let the user change the page size and present options inside the paging toolbar, as per the following screenshot:
One way to achieve this is to simply modify our custom FinancialGrid
component, where we set the toolbar before as follows:
BottomBar.Add(new PagingToolbar());
We could replace it with something like the following line of code:
BottomBar.Add(BuildBottomBar());
The BuildBottomBar
method is defined as follows::
private PagingToolbar BuildBottomBar() { return new...