[CLOSED] Loop through filters Gridpanel

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Loop through filters Gridpanel

    Hi,

    I've updated from SVN (about time.. :) ) , but now this piece of Javascript (which worked) gives no result anymore for the filters:

    var getSettings = function() {
                var settings = {
                    sortState: { },
                    columns: [],
                    groupField: "",
                    filter: []
                };
    
    
                var cm = gridPanel.getColumnModel();
                for ( var i = 0, len = cm.config.length; i < len; i++ ) {
                    settings.columns.push( { dataIndex: cm.getDataIndex( i ), width: cm.getColumnWidth( i ), hidden: cm.isHidden( i ) || false } );
                }
    
    
                settings.sortState = gridPanel.store.getSortState() || { field: "", direction: "" };
                settings.groupField = gridPanel.store.groupField || "";
    
    
                gridPanel.getFilterPlugin().filters.each( function( f ) {
                    alert( f.dataIndex );
                    if ( f.active ) {
                        settings.filter.push( { field: f.dataIndex, args: f.serialize() } );
                    }
                } );
                Hidden.setValue( Ext.encode( { settings: [settings] } ) ); // <--- EXT.NET.HIDDEN
            };
    Its difficult to send all the code, but this is the issue. I'm using the code to save the settings of my filters and use the filters in a query.
    The problem is looping through the filters

    Any Idea ? It still works on production (which hasn't the latest DLL's)

    Martin
    Last edited by Daniil; Apr 25, 2012 at 10:06 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I've just tried your code with these examples
    https://examples1.ext.net/#/GridPane...Filters_Local/
    https://examples1.ext.net/#/GridPane...ilters_Remote/
    and the latest sources from SVN. It appears to be functioned correctly.

    I can't see any changes in SVN which would stop it working.

    A full sample to reproduce the problem would be best.

    For now, which moment do you call the getSettings function?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    I've just tried your code with these examples
    https://examples1.ext.net/#/GridPane...Filters_Local/
    https://examples1.ext.net/#/GridPane...ilters_Remote/
    and the latest sources from SVN. It appears to be functioned correctly.

    I can't see any changes in SVN which would stop it working.

    A full sample to reproduce the problem would be best.

    For now, which moment do you call the getSettings function?
    Mmm...strange. The difference with both examples is that I create my filters in codebehind.
    I shall try to create an example

    Martin
  4. #4
    The difference with both examples is that I create my filters in codebehind.
    I can't see any reason how it can break the code. Yes, providing us with a sample would be best.
  5. #5
    Used firebug to check the Dom. Was able to fix my code, but still no idea why it didn't work like before. This is my new loop through the filters:

    for (var item in gridPanel.filters.filters.items) {
                       var itm = gridPanel.filters.filters.items[item];
                                         if (itm.active) {
                                              settings.filter.push({ field: itm.dataIndex, args: itm.serialize() });
                                          }
                   }
    So..solved, but with some doubts :)

    Martin
  6. #6
    So, you've just replaced
    gridPanel.getFilterPlugin().filters.each( function( f ) {
    with
    for (var item in gridPanel.filters.filters.items) {
    right?

    Very strange. I would be happy to investigate if you will able to provide us with an example.

    Probably, there is some issue and I can't guarantee it won't be broken again.
  7. #7
    Quote Originally Posted by Daniil View Post
    So, you've just replaced
    gridPanel.getFilterPlugin().filters.each( function( f ) {
    with
    for (var item in gridPanel.filters.filters.items) {
    right?

    Very strange. I would be happy to investigate if you will able to provide us with an example.

    Probably, there is some issue and I can't guarantee it won't be broken again.
    The problem with my production code is, that it's created by multiple external sources (xml files, sqldatabase etc). It's quite difficult to send you an example code. I can give you an online login thought. Maybe you can check the rendered code ? Just let me know

    Martin
  8. #8
    I can give you an online login thought. Maybe you can check the rendered code ?
    Yes, it can help.
  9. #9
    Quote Originally Posted by Daniil View Post
    Yes, it can help.
    Will be next week. Stil bugfixing in latest version of my application. Will inform you. Can I send login/password to helpdesk email ?

    Martin
  10. #10
    You can send directly to me.
    daniil at ext dot net
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] How to clear GridPanel filters on the client?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jan 18, 2013, 10:33 AM
  2. Replies: 4
    Last Post: Feb 21, 2012, 5:36 PM
  3. Replies: 3
    Last Post: Jan 12, 2012, 3:26 PM
  4. [CLOSED] loop though gridpanel and update store
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 03, 2011, 8:11 AM
  5. gridpanel loop
    By maxdiable in forum 1.x Help
    Replies: 4
    Last Post: Jul 09, 2009, 9:37 AM

Posting Permissions