[CLOSED] Is there a grid filters extension to select rows with empty (null) field values?

  1. #1

    [CLOSED] Is there a grid filters extension to select rows with empty (null) field values?

    Hello:

    I have a case where the users have to enter missing values (they are sparse) and I was thinking of providing a grid panel filter to select just the rows that are missing the values (the users need to see other data in order to know which values to put in the empty cells).

    I found this: https://www.sencha.com/forum/showthr...lues-filtering and I was wondering if you have something similar integrated in Ext.Net.

    In my case the columns contain dates but I guess this extension can be used with any columns.

    Thanks!
    Last edited by Daniil; May 22, 2015 at 10:43 AM. Reason: [CLOSED]
  2. #2
    Hello @bogc,

    Sorry, as far as I can remember there is no such thing built in Ext.NET.
  3. #3
    I ended up implementing my own.


    Ext.define('Ext.ux.grid.filter.DateFilterEx', {
      extend: 'Ext.ux.grid.filter.DateFilter',
      alias: 'gridfilter.datex',
      uses: ['Ext.ux.grid.filter.DateFilter', 'Ext.menu.Menu'],
    
      emptyText: 'Empty values',
    
      menuItems: ['before', 'after', '-', 'on', '-', 'empty'],
    
      compareMap: {
        before: 'lt',
        after: 'gt',
        on: 'eq',
        empty: 'empty'
      },
    
      init: function (config)
      {
    
        this.callParent(arguments);
    
        // Let's remove the date menu associated with empty
    
        this.fields.empty.menu = null;
      },
    
      onCheckChange : function(item, checked)
      {
        var me = this;
    
        if (item == this.fields.empty)
        {   
          me.setActive(me.isActivatable());
          me.fireEvent('update', me);
          return;
        }
        this.callParent(arguments);
      },
    
      validateRecord: function (record)
      {
        var val = record.get(this.dataIndex);
        
        // If we want to see empty values and this is not an empty value then 
        // don't include this row
        if (this.fields.empty.checked && val != null)
          return false;
    
        // If the value is null and any of the other filters are on then don't include any record
        // because it doesn't make sense to compare a null against an existing date. If none of the filters
        // are on then include the row
        if (val == null)
          return !this.fields.on.checked && !this.fields.before.checked && !this.fields.after.checked;
    
        return this.callParent(arguments);
      }
    });
  4. #4
    Thank you very much for sharing!

Similar Threads

  1. Replies: 1
    Last Post: Nov 07, 2013, 2:40 PM
  2. Replies: 0
    Last Post: Apr 05, 2012, 5:28 AM
  3. Replies: 1
    Last Post: Mar 29, 2012, 10:42 PM
  4. [CLOSED] Rows empty grid using DataTable.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 13, 2011, 9:19 PM

Posting Permissions