Code Monkey home page Code Monkey logo

Comments (2)

siddharatha avatar siddharatha commented on July 20, 2024

I am using a strike datagrid where I have implemented a custom search just to narrow the results.

// dataGridWrapperHelper.js 

 performSearch:function(component){
        var helper = this;
        this.debouncedSearch = _.debounce($A.getCallback(function(component){          
            var data = component.get('v.data');          
            var unfilteredRows = component.get('v.unfilteredRows');
            var search = _.toLower(component.get('v.search'));         
            if(_.isEmpty(search))
                data.rows=_.clone(unfilteredRows);        
            else
                data.rows = _.sampleSize(_.filter(unfilteredRows,function(result){return _.toLower(JSON.stringify(_.values(result))).indexOf(search) >=0}),50);                      
            component.set('v.data',data);
            component.find('dataGrid').set('v.data',data);
            helper.prepareChartData(component);
            helper.stopWaiting(component);
        }),250, { 'maxWait': 1000 });
    },
    debouncedSearch:function(component){
        
    },

and the controller defining the debounce function

// dataGridWrapperController.js 

 doInit: function(component,event,helper){        
        helper.performSearch(component);        
    },

may be this can help ?

from lightning-data-grid.

madmax983 avatar madmax983 commented on July 20, 2024

@siddharatha I am working on this right now, so thank you for the help. One of the guiding principles for his grid is to allow extensibility, so the general concept I have right now is to allow a hook into changing the view with a GridViewMutation event. You send the type of mutation along with the mutated (filtered or searched data), and the grid will take care of updating the view for you. This will allow #5 and #6 to utilize the same event interface.

Let me get what I've been working on committed and let me know what you think

from lightning-data-grid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.