1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    3
    Vote Rating
    0
    ksj is on a distinguished road

      0  

    Default Unanswered: Filter question

    Unanswered: Filter question


    Hi,

    I am beginner to Sencha. I am writing one simple program where I have to filter some store data.
    If I do this in test project, it works. But in actual project the store.filter() always return empty list. There is absolutely no difference between two projects as far as code is concerned. I observed one thing though, in my test project, store.getData() returns following info.

    Class
    • _autoFilter: true
    • _autoSort: true
    • _filterRoot: "data"
    • _filters: Class
      • _autoFilter: true
      • _autoSort: true
      • all: Array[1]
        • 0: Class
          • _filterFn: function (item) {
          • _id: "optionid-1"
          • _property: "optionid"
          • _root: "data"
          • _value: 1


    and in actual project, the same variable is displayed as:

    Class
    • _autoFilter: true
    • _autoSort: true
    • _filterRoot: "data"
    • _filters: Class
      • _autoFilter: true
      • _autoSort: true
      • all: Array[1]
        • 0: Class
          • _filterFn: function (item) {
          • _id: Class
          • _property: Class
          • _root: "data"

    Portion marked in red is the only difference i can think of. Would this cause issue? Is it due to referring different jar files?

    Thanks in advance





    • #2
      Sencha - Senior Forum Manager mitchellsimoens's Avatar
      Join Date
      Mar 2007
      Location
      Gainesville, FL
      Posts
      36,795
      Answers
      3466
      Vote Rating
      834
      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


      code?
      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
      Sencha User
      Join Date
      Oct 2012
      Posts
      3
      Vote Rating
      0
      ksj is on a distinguished road

        0  

      Default Code

      Code


      hey!! thanks for reply, please go though the code below:

      Test project code:[working]

      Ext.define('Test.view.TeenPage',{
      extend:'Ext.form.Panel',
      xtype:'teenpage',
      id:'teenpage',
      config:{
      title: 'Teen!',
      layout:'card',
      listeners: {
      painted:function() {
      console.log("Inside painted");
      store = Ext.getStore('TeenStore');

      store.clearFilter();
      var filter = new Ext.util.Filter({
      property: 'optionid', value: 1
      });

      store.filter(filter);
      console.log(store.getData());
      }
      },
      },
      });

      Actual Page code:

      Ext.define('Actual.view.login.TeenPage',{
      extend:'Ext.form.Panel',
      xtype:'teenpage',
      id:'teenpage',
      config:{
      title: 'Teen!',
      layout:'fit',

      listeners: {
      painted:function() {
      console.log("Inside teen page painted");
      store = Ext.getStore('TeenStore');

      store.clearFilter();
      var filter = new Ext.util.Filter({
      property: 'optionid', value: 1
      });
      store.filter(filter);
      console.log(store.getData());
      }
      },
      }
      });

      Thanks,

    • #4
      Sencha User
      Join Date
      Oct 2012
      Posts
      3
      Vote Rating
      0
      ksj is on a distinguished road

        0  

      Default adding list code

      adding list code


      Additions marked inline
      TEST:
      Ext.define('Test.view.TeenPage',{
      extend:'Ext.form.Panel',
      xtype:'teenpage',
      id:'teenpage',
      config:{
      title: 'Fun for Teen!',
      layout:'card',
      listeners: {
      painted:function() {
      store = Ext.getStore('TeenStore');
      store.clearFilter();
      var filter = new Ext.util.Filter({
      property: 'optionid', value: 1
      });
      store.filter(filter);
      }},
      items:[
      {
      xtype:'list',
      store:'TeenStore',
      itemTpl:'<h1>{optionid}.{question}</h1> \
      <h2> \
      <input type="radio" name="Q1Answer" value= {option1}/> {option1}<br/> \
      <input type="radio" name="Q1Answer" value= {option2}/> {option2}<br/> \
      <input type="radio" name="Q1Answer" value= {option2}/> {option3}<br/> \
      </h2>'
      },
      ]},
      });

      Actual:
      Ext.define('SLAL.view.login.TeenPage',{
      extend:'Ext.form.Panel',
      xtype:'teenpage',
      id:'teenpage',
      config:{
      title: 'Fun for Teen!',
      layout:'card',

      listeners: {
      painted:function() {
      store = Ext.getStore('TeenStore');
      store.clearFilter();
      var filter = new Ext.util.Filter({
      property: 'optionid', value: 1
      });
      store.filter(filter);
      }},
      items:[
      {
      xtype:'list',
      store:'TeenStore',
      itemTpl:'<h1>{optionid}.{question}</h1> \
      <h2> \
      <input type="radio" name="Q1Answer" value= {option1}/> {option1}<br/> \
      <input type="radio" name="Q1Answer" value= {option2}/> {option2}<br/> \
      <input type="radio" name="Q1Answer" value= {option2}/> {option3}<br/> \
      </h2>'
      },
      ]}
      });

    Thread Participants: 1

    Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi