[CLOSED] Remote GridFilter is not removed

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Remote GridFilter is not removed

    Hello,

    I´ve implemented a dynamic solution of the Reemote GridFilter:
    https://examples1.ext.net/#/GridPane...ilters_Remote/

    The filtering itself works fine now, but I cannot remove a filter.
    When I remove a filter (uncheck the checkbox), the defined filter still remains.

    I also can see that in firebug (see also attached screenshot):

    gridfilters<code aria-selected="true" tabindex="0" role="listitem" class="focusRow 
    subFocusRow a11yModified">{"f_0_field":"GERAET_CODE","f_0_data_type":"string","f_0_data_value":"AE-TEST"}</code>
    The filters are defined like this:

    private void InitColumnModel() {
                if (_tableConfig.HeaderRowFilter) {
                    GridFilters filters = new GridFilters();
                    filters.ID = "DynamicSearchGridFilters";
                    if (_tableConfig.RequestMode == RequestModeType.Local)
                        filters.Local = true;
    
                    if (DynamicSearchGridPanel.Plugins.Count > 0)
                        DynamicSearchGridPanel.Plugins[0] = filters;
                    else
                        DynamicSearchGridPanel.Plugins.Add(filters);
                }
    foreach (ColumnConfig cc in _tableConfig.SearchColumns.Values) {
                    Column c = ExtNETUtils.LoadColumn(cc);
                    //HeaderColumn hc = GenerateHeaderFilterControl(cc);
                    GridFilter gf = GenerateGridFilter(cc);
    
    //..
        if (gf != null) {
                      
                        (DynamicSearchGridPanel.Plugins[0] as GridFilters).Filters.Add(gf);
                    }
    
    
    //...
    
    
    }
    
    
    private GridFilter GenerateGridFilter(ColumnConfig cc) {
                if (!_tableConfig.HeaderRowFilter)
                    return null;
    
                GridFilter gf = null;
    
                if (Utils.IsBoolean(cc.Schema)) {
                    gf = new BooleanFilter();
                } else if (Utils.IsNumeric(cc.Schema) &amp;&amp; !cc.Schema.IsForeignKey) {
                    gf = new NumericFilter();
                } else if (DateTimeUtils.IsDateTime(cc.Schema)) {
                    gf = new DateFilter();
                } else {
                    gf = new StringFilter();
                }
                gf.DataIndex = cc.ColumnName;
    
                
    }

    It´s a bit complicated to provide a working example of my dynamic solution,
    so I hope these codesnippets are enough to solve my problem.


    Regards,

    Martin
  2. #2

    RE: [CLOSED] Remote GridFilter is not removed

    Hi,

    I cannot reproduce the issue. For me the filtering parameter is gone if uncheck filter menu item
    Do you use Local filtering? In any way we need sample to understand the problem
  3. #3

    RE: [CLOSED] Remote GridFilter is not removed

    In your remote sample the filter is also gone, but but not in mine :-)

    I will try to reproduce the problem somehow.

    Regards,

    Martin
  4. #4

    RE: [CLOSED] Remote GridFilter is not removed

    It´s really not that easy to provide a simple example.

    Therefore I have another question which maybe helps me.

    Is there a way to set the JSON-Parameter "by Hand"?


    Like:

     protected void DynamicSearchStore_Submit(object sender, StoreRefreshDataEventArgs e)
            {
                if (DynamicSearchGridPanel.Plugins.Count > 0 &amp;&amp; DynamicSearchGridPanel.Plugins[0] is GridFilters)
                {
                    GridFilters gfs = (GridFilters) DynamicSearchGridPanel.Plugins[0];
                  // Store.ExtraParam["grifFilters"] =    get filterConditions as JSON <code aria-selected="true" tabindex="0" role="listitem" class="focusRow <br>
    subFocusRow a11yModified">("f_0_field":"GERAET_CODE","f_0_data_type":"string","f_0_data_value":"AE-TEST")</code>
    
                }
             
            }
    This solution would also help me in another way, because I want to Export my Results via my GridDataHandler.ashx to Excel with a special library.


    Regards,

    Martin
  5. #5

    RE: [CLOSED] Remote GridFilter is not removed

    Hi,

    You can get filters conditions
    #{GridPanel1}.getFilterPlugin().buildQuery(#{GridPanel1}.getFilterPlugin().getFilterData())

    You can use it in the BaseParamsof the Store
    <ext:Parameter Name="gridFilters" Value="#{GridPanel1}.getFilterPlugin().buildQuery(#{GridPanel1}.getFilterPlugin().getFilterData())" Encode="true" Mode="Raw" />


  6. #6

    RE: [CLOSED] Remote GridFilter is not removed

    This works fine and solved my problem. :-)
  7. #7

    RE: [CLOSED] Remote GridFilter is not removed

    I have another question similar to this problem.

    Is there a way to add the filter-values to the HttpContext.Current object?

    I need this to make my Excel-Export working.



    Regards,

    Martin
  8. #8

    RE: [CLOSED] Remote GridFilter is not removed

    Hi,

    You can set filter conditions to the some hidden field (in the Before handler of the direct event or in the appropriate listener) and read it from the field directly or from HttpContext.Current.Request.Form
  9. #9

    RE: [CLOSED] Remote GridFilter is not removed

    Hi,

    I am still having a problem with it.

    I define a Listener:

       MenuItemExportExcel.Listeners.Click.Handler = "#{FilterValue}.setValue(#{DynamicSearchGridPanel}.getFilterPlugin().buildQuery(#{DynamicSearchGridPanel}.getFilterPlugin().getFilterData()));";
    to load the filter into my Ext.Hidden field "FilterValue".


    I am using this value in my method for the Excel-Export-Button:

         public void ExportExcel(object sender, EventArgs e)
            {
    
                FilterConditions fc = null;
                if (!String.IsNullOrEmpty(FilterValue.Text))
                {
                    fc = new FilterConditions(FilterValue.Text);
                }
                PageUtils.ExportAsExcel(Response, _tableConfig, _pageConfig, SearchField.Text, fc);
            }

    But the FilterValue.Text is an object and not a string.
    How can I parse this JS-Object into a simple string to pass it to the FitlerConditions constructor?


    Regards,

    Martin
  10. #10

    RE: [CLOSED] Remote GridFilter is not removed

    Hi,

    You have to encode js object before write to the hidden field
    MenuItemExportExcel.Listeners.Click.Handler = "#{FilterValue}.setValue(Ext.encode(#{DynamicSearchGridPanel}.getFilterPlugin().buildQuery(#{DynamicSearchGridPanel}.getFilterPlugin().getFilterData())));";
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Remote ListFilter (gridFilter)
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 26, 2012, 3:28 PM
  2. [CLOSED] GridFilter Remote ComboBox filter
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 17, 2011, 3:20 PM
  3. [CLOSED] gridfilter remote question
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 24, 2011, 4:14 PM
  4. [CLOSED] SetText removed
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 19, 2008, 5:36 PM

Posting Permissions