Advanced Plugins
Now that we know how to write a basic plugin, let's take a look at some complex examples.
Using the pipeline
Grid.js has an internal pipeline which is the brain of Grid.js and takes care of processing, filter and refining the data.
You can always get access to the current pipeline by using this.config.pipeline
in your plugin component (make sure you have extended BaseComponent
).
In this example, we have a table of Name (string) and Salary (double) and our custom plugin is in charge of summing salaries and displaying the total in the footer.
Using the translation
Likewise, you can get access to the Translator object and localize strings in your custom plugin. _
is a method of BaseComponent
and since you've extended BaseComponent
, you will have access to this._
throughout your custom plugin: