Filtering by component issue

Hi @Helga ,
https://snippet.webix.com/uxnf4ttt

I tired out the above snippet in the same manner as you did but am not able to filter what is that am missing ?.Am facing the same issue in my local coding also.

Thanks

Comments

  • edited June 2018

    Hi,

    Please, log the data you need to filter or check the documentation.

    The filter() method takes either two arguments (field name and mask), or a filterting function, that works with the necessary field name.

    The most important thing is that you need to provide the name of the necessary field from your data. In the snippet above, it is "name", not "continent". In your data it can be something else.

    So, please use the first approach as: https://snippet.webix.com/fzazoznt

    Or, the filtering function: https://snippet.webix.com/71jx7dqz

  • YA got it @Helga ...Thnaks... the same filter mechanism can be applied to multiselect cobo box which is selectAll option as well ?

  • edited June 2018

    Yep, basically the same: you just have to compare the data field ("name" in you case) with the multicombo value.

    But please note the control outputs a comma-separated string with values, so the comparison should be changed to:

    $$("pivot").$$("data").filter(function(obj){
         return newv.indexOf(obj.name) !== -1; 
    });
    

    https://snippet.webix.com/m0y1ghy4

  • Thanks @Helga .. I got it working .. I usingthe above logic to filter the pivot grid based on the selection in the multi select box.The issue now am facing is by default my pivot table should be filtered by state:"Failed" ,so only failed state data will be visible in the grid but there will be data with other states like pending, killed also. But by above scenario i can filter only what is present in the grid(only failed)So am not able to filter other states.
    Basically i need a separate multiselect with selectAll option component which is same has in-build that a pivot grid provides..Is that possible ?

  • @Helga can the below snippet be used to filter the pivot grid by state:failed?
    without the use of in-build filetr in pivot ? where it can be used ?can it be within onBeforerender?

    $$("pivot").$$("data").filter(function(obj){
    return newv.indexOf(obj.name) !== -1;
    });

  • edited June 2018

    I'm not sure that I understand you correctly, but if you want to filter the already fileted set, you can call the filter() method with the 3rd parameter: https://docs.webix.com/api__link__ui.datatable_filter.html

  • @Helga
    The below link-snippet explains my scenario ,expect i missed to hide the filter in pivot with below on:{} snippet.
    https://snippet.webix.com/sax2v20n

    on: {
    onViewInit: function(name, config){
    if(name == "filters" && $$("chartFilters"))
    webix.ui(config.elements, $$("chartFilters"));
    config.elements = false;
    },

    My pivot table will be already filter by state:"Failed" like in the above case with the filter "Republic" but i have to filter by the external combo box or multiselect box which is holding other states like:pending,killed,completed. But i can't filter it bcos the pivot table is having only the failed state.

    1.My requirement is i want a external multi select filter which exactly same has in-build pivot multi select filter Is this possible?

    2.If 1 st point is not possible can selectAll options be included within the in-built pivot multiselect filter

    Thanks in advance

  • edited June 2018

    You can easily add the "Select All" option to the built-in filter. Please check the snippet: https://snippet.webix.com/ny0mdqjl

    Or you can move it outside, it doesn't really matter: https://snippet.webix.com/c61ugool

  • Thanks a lot @Helga :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!