fin-hypergrid / core

A canvas-based super high performant grid renderer API
MIT License
897 stars 144 forks source link

How to use plugins (e.g. datasaur-indexed) with client-side JS only? #763

Open RandomGHUser opened 6 years ago

RandomGHUser commented 6 years ago

I'm trying to do filtering on my Hypergrid, but I cannot seem to attach the dataModel properly, the grid.behavior.dataModel does not have a setFilter function, could someone help with setting this up, or point to a vanilla JS tutorial for filtering? I've looked through the documentation at https://github.com/fin-hypergrid/datasaur-indexed and https://github.com/fin-hypergrid/fin-hypergrid-filtering-demo

but am unable to figure it out. What I have added to my page is the datasaur-indexed.js file, the 2 local/filter variables, and the dataModel: new DataModelFilter(new DataModelLocal)

Any clues? I'm not receiving any errors, but am also not seeing the setFilter function.

         <script src="/modules/hypergrid/datasaur-indexed.js"></script>

javascript snippet:

var div = document.querySelector('div#' + this.config.div_id);
var DataModelLocal = fin.Hypergrid.require('datasaur-local'); // v3.0.0 or higher
var DataModelFilter = fin.Hypergrid.require('datasaur-indexed'); // this version must be >= that of datasaur-local
grid = new fin.Hypergrid(div, {
           dataModel: new DataModelFilter(new DataModelLocal),
            data: data.data,
            schema: this.config.customSchema
        });