Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    79
    Answers
    7
    Vote Rating
    1
    jonathansimmons is on a distinguished road

      0  

    Default Unanswered: filterBy not working..

    Unanswered: filterBy not working..


    So I'm trying to filter a store before a list loads

    if I use:
    Code:
        beforeRender: function() {
            this.store = myApp.stores.myStore;
            myApp.stores.myStore.load();
            myApp.stores.myStore.filter('id',1)
        },
    The store is filtered and only the first record shows. When I use:
    Code:
        beforeRender: function() {
            this.store = myApp.stores.myStore;
            myApp.stores.myStore.load();
            myApp.stores.myStore.filterBy(function(record, id){
                if (id == 2) {
                return true
                } else {
                return false
                }
            });    
        },
    No filtering happens I just get all the records.

    The goal is to filter the store by an array of id's but I haven't gotten there because I can't seem to get filterBy to work. Can anyone seem anything I might be doing wrong?


    EDIT:
    I just added some breakpoints to the .js file and it appears if I break on the actual filter call the breakpoint is called. If I put a breakpoint inside that function it is completely ignored. Which makes me feel like the function is just not being called.
    Last edited by jonathansimmons; 18 Feb 2012 at 10:33 AM. Reason: added info

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I have used filterBy with no issues. You can optimize your code by doing:

    Code:
            myApp.stores.myStore.filterBy(function(record, id){
                return id === 2;
            });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    79
    Answers
    7
    Vote Rating
    1
    jonathansimmons is on a distinguished road

      0  

    Default still not working...

    still not working...


    Yea I knew the code wasn't the prettiest but it was straight forward and I knew it would fire properly. Even still optimizing the code with your example doesn't work.

    I just don't know whats wrong. Would would filter work but not filterBy?

    I'm doing this in the beforerender listener on the list, after assigning the list store and loading it. Is there a better way to go about this? I assumed it was fine because it worked with filter but now I just don't know.

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    79
    Answers
    7
    Vote Rating
    1
    jonathansimmons is on a distinguished road

      0  

    Default frustrated.

    frustrated.


    So I'm just frustrated. I must be doing something wrong I just wish I could see what.

    To troubleshoot I created the following sample page in my app. Which in short just creates a model and stor with json data inline and filters it before the list is shown.
    Code:
    Ext.regModel('Contact', {    fields: ['id', 'lastName']
    });
    
    
    var store = new Ext.data.JsonStore({
        model  : 'Contact',
        sorters: 'lastName',
            
        getGroupString : function(record) {
            return record.get('lastName')[0];
        },
    
    
        data: [
            {id: 1, lastName: 'Maintz'},
            {id: 2, lastName: 'Dougan'},
            {id: 3, lastName: 'Spencer'},
            {id: 4, lastName: 'Avins'},
            {id: 5, lastName: 'Conran'},
            {id: 6, lastName: 'Kaneda'},
            {id: 7, lastName: 'Mullany'},
            {id: 8, lastName: 'Elias'},
            {id: 9, lastName: 'Robinson'},
            {id: 10, lastName: 'Maintz'},
            {id: 12, lastName: 'Dougan'},
            {id: 13, lastName: 'Spencer'},
            {id: 14, lastName: 'Avins'},
            {id: 15, lastName: 'Conran'},
            {id: 16, lastName: 'Kaneda'},
            {id: 17, lastName: 'Mullany'},
            {id: 18, lastName: 'Elias'},
            {id: 19, lastName: 'Robinson'}
        ]
    });
    store.filterBy(function(record, id){
        test = [1,2,3];
        // console.log(record.get('id'))
            if (test.indexOf(record.get('id')) != -1) {
                console.log("true")
                console.log(record.get('id'))
                return true;
            } else {
                console.log("false")
                return false;
            }
    });
    
    
    var list = new Ext.List({
        fullscreen: true,
        scroll: true,
        itemTpl : '{id} {lastName}',
        grouped : true,
        indexBar: true,
        
        store: store
    });
    
    
    myApp.views.myView = Ext.extend(Ext.Panel, {
            fullscreen: true,
            id: 'Contacts',
            iconCls: 'blank',
            title: "Contacts",
            scroll: "vertical",
            items: [list],
            html: "Contacts",
            listeners: {
                activate: function() {
                    
                }
            }
    });
    This works fine. The store is filter for contacts with ID of 1, 2 or 3.

    This simple just will not work where I need it to in the beforerender on a list. My big issue is that it truly appears to not even being doing the filterBy function. I say this as I've simple just run
    Code:
    this.store.filterBy(function(record, id){
        console.log('filterBy function called');
    });
    and that never gets logged.

    Everything else inside of the beforerender event works fine. So why would this not be run? Added breaks to the .js file confirms this as if I add a break to the line for the filterBy function itself it stops for the break but if I add it to any line inside the filterBy the break is never hit.

    does anyone, ANYONE have any thoughts?

  5. #5
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    89
    Answers
    1
    Vote Rating
    2
    zmagyar is on a distinguished road

      0  

    Default


    Have you ever solved this problem? I just hit the same issue and looking for solutions.

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Posts
    79
    Answers
    7
    Vote Rating
    1
    jonathansimmons is on a distinguished road

      0  

    Default


    Hey zmagyar. I actually never did get this working. Shortly after this I moved to using Sencha Touch 2 which in my opinion has a bit of a learning curve. However I've been nothing but pleased with it and have not run into any issues like the code above.

    Sorry that is not a beter answer.

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When the filterBy executes, are we sure the store is loaded?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  8. #8
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    89
    Answers
    1
    Vote Rating
    2
    zmagyar is on a distinguished road

      0  

    Default


    Adding a console.log indicates the store itself is loaded (dumping the store the data member is fully populated) but the log placed inside the filterBy function never fires.

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    814
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you do

    Code:
    console.log(store.data);
    or something like

    Code:
    console.log(store.getCount());
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  10. #10
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    89
    Answers
    1
    Vote Rating
    2
    zmagyar is on a distinguished road

      0  

    Default


    Just
    Code:
    console.log(store);
    then browsing the dumped object.