Results 1 to 5 of 5

Thread: Filter grid column by rendered value.

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2018
    Posts
    6

    Default Answered: Filter grid column by rendered value.

    Hi,

    I'm using extjs 6.5.3 for a multi language app.
    I need to filter the columns of a grid using the string that appears to the user (Car/Truck in English Auto/Camion in Italian), not the value in the store(vtCar/vtTruck) that I use for some function.
    I can't modify the value in the store using 'convert' because I need it that way.
    The same concept applies to the exportation but I really don't know how to do it, some ideas?

    Thanks in advance.

  2. Filter happens at the store level, not the view level so you need to have the data within the store.

    What does your renderer look like? Is it just joining different fields together and returning that?

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,451
    Answers
    3997

    Default

    Filter happens at the store level, not the view level so you need to have the data within the store.

    What does your renderer look like? Is it just joining different fields together and returning that?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha Premium Member
    Join Date
    Jun 2018
    Posts
    6

    Default

    These are the functions I use for the render:
    Code:
    renderVehicleType:function(value){
    returnTest.utils.Global.rowRendererType('TVehicleType',value);
    },
    
    
    rowRendererType :  function(ltype,val) {
            langStore=typeStore.data.items;
            Ext.each(langStore,function(row){
                if(row.data.typegroup==ltype && row.data.typevalue==val){
                    return row.data.typelanguage;
                }
            });
        
            return result
        }
    
    
    
    typeStore is a store that contains the string value(typevalue), the relative translation into the current language(typelanguage) and the group of the string(typegroup) that serves to identifie the correct translation.

    So I have to create a new field where I put the translation and show it instead of the value?

  5. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,451
    Answers
    3997

    Default

    So two options.

    First is to have a field in your store that uses your rowRendererType method and then use that for your dataIndex of your column. This has also has the side affect of allowing sorting to just work and sort by what is display as it will use the dataIndex too. Also, the converting will happen when the store is loaded (and for any updates of the depended fields) whereas rendering will re-execute the rowRendererType for each render of that row. May not be a big deal unless the infinite scrolling comes into play.

    Second is when you filter, you can pass a filterFn instead of simple property/value and within it, it can use the same rowRendererType to get the value. This won't work if you want to use the filter plugin as it's a simple property/value filtering.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #5
    Sencha Premium Member
    Join Date
    Jun 2018
    Posts
    6

    Default

    Thanks,
    I've adopt the first solution and it works.

Similar Threads

  1. Grid: How to apply a filter on a rendered column?
    By BenjaminNue in forum Ext JS 6.x Q&A
    Replies: 0
    Last Post: 21 Apr 2017, 12:36 AM
  2. Adding Filter Icon in Grid Column Header after the filter is applied
    By 2mailpks in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 30 Aug 2016, 9:44 PM
  3. Filter a grid on it's rendered values?
    By Volvorst in forum Ext: Q&A
    Replies: 1
    Last Post: 10 Feb 2014, 8:15 AM
  4. Replies: 4
    Last Post: 3 Jun 2013, 4:19 AM
  5. ux.grid.GridFilters local - filter on rendered column
    By kamil.schvarcz in forum Ext 3.x: User Extensions and Plugins
    Replies: 1
    Last Post: 9 Jul 2010, 12:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •