jQuery UI Widgets Forums Grid Filter input not working

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  admin 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Filter input not working #135249

    gerryw
    Participant

    Hi,
    I’m trying to get a grid filter working. I basically want to filter all columns based on the text in a jqxinput. What am I doing wrong?

     $("#filter-input").jqxInput({
        placeHolder: "Enter filter text", 
        height: 25, 
        minLength: 1});
    
      // Initialize jqxGrid
      $("#jqxgrid").jqxGrid({
        width: '100%',
        height: '100%',
        source: dataAdapter,
        columnsresize: true,
        filterable: true,
        theme: "metro",
        columns: [...]
      });
    
     // Filter input handling
      $('#filter-input').on('input', function () {
        var searchText = $(this).val().toLowerCase();
        $("#jqxgrid").jqxGrid('clearfilters');
        var filtergroup = new $.jqx.filter();
        var filter_or_operator = 1;
    
        source.datafields.forEach(function (field) {
          var filtervalue = searchText;
          var filtercondition = 'contains';
          var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
          filtergroup.addfilter(filter_or_operator, filter);
        });
    
          $("#jqxgrid").jqxGrid('addfilter', 'name', filtergroup);
          $("#jqxgrid").jqxGrid('applyfilters');
          alert("filter")
      });
    

    Thanks,
    -G

    Filter input not working #135252

    admin
    Keymaster

    Hi,

    This is already built-in and supported by jqxGrid. Please, take a look at https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filterall.htm?fluent

    Hope this helps.

    Best regards,
    Peter Stoev

    JQWidgets Team
    https://www.jqwidgets.com/

    Filter input not working #135255

    gerryw
    Participant

    Hi,

    That worked. Thanks! Is there a way to resize the search field and add a button to the filter bar?

    Thanks,
    -G

    Filter input not working #135262

    admin
    Keymaster

    Hi,

    This is possible with this code: .jqx-grid .jqx-input-group-addon { width: 300px; }

    Best regards,
    Peter Stoev

    JQWidgets Team
    https://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.