1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default How to get unique/Distinct data from store?

    How to get unique/Distinct data from store?


    Hi, i am using the extjs. i need to retrieve distinct data from store as per requirement. In my store contains single list not nested list in that have regions like AMERICAS , North Sea and SE Asia. these region it self have subRegion,vesselName and vesselType values. I need to retrive unique value based on region, bacasue it contains many duplicate records. I have tried like as below, but it is not working me. Can anybody tel me how to achieve ?. great appreciated. Thank you.

    Code:
     var vesselStore=Ext.getStore('VesselStatusReportStore');
            var arr=new Array();
            var obj;      
            vesselStore.each(function(rec,index)
            {
                obj=new Object();
                if(rec.get('region')=='AMERICAS'){
                    obj.subRegionAmerica=rec.get('subRegion');
                    obj.vesselNameAmerica=rec.get('vesselName');
                    obj.vesselTypeAmerica=rec.get('vesselType');
                }
                if(rec.get('region')=='NorthSea'){
                    obj.subRegionNorthSea=rec.get('subRegion');
                    obj.vesselNameNorthSea=rec.get('vesselName');
                    obj.vesselTypeNorthSea=rec.get('vesselType');
                }
                if(rec.get('region')=='SE Asia'){
                    obj.subRegionSEAsia=rec.get('subRegion');
                    obj.vesselNameSEAsia=rec.get('vesselName');
                    obj.vesselTypeSEAsia=rec.get('vesselType');
                }
                arr.push(obj);
                console.log(obj);
            });
    My Json Data:

    Code:
    [ { 
        "region" : "AMERICAS",
        "startDate" : null,
        "subRegion" : "US",
        "vesselName" : "Thoma-Sea � Hull #147",
        "vesselType" : "PSV"
      },
      { 
        "region" : "AMERICAS",
        "startDate" : null,
        "subRegion" : "US",
        "vesselName" : "Thoma-Sea � Hull #148",
        "vesselType" : "PSV"
      },
      { 
        "region" : "AMERICAS",
        "startDate" : null,
        "subRegion" : "Mexico",
        "vesselName" : "Thoma-Sea � Hull #148",
        "vesselType" : "PSV"
      }]
    Last edited by Rameshlamani; 3 Apr 2013 at 10:24 PM. Reason: By the json data can easily understand

  2. #2
    Sencha User Legolas's Avatar
    Join Date
    Apr 2010
    Location
    Brazil/MG
    Posts
    58
    Vote Rating
    3
    Legolas is on a distinguished road

      1  

    Default


    Quote Originally Posted by Rameshlamani View Post
    I need to retrive unique value based on region, bacasue it contains many duplicate records
    Hi Rameshlamani, you may use the method collect.
    I am sorry my english, I am learning yet
    Portuguese blog: http://wessdevel.blogspot.com.br/
    Twitter: @wlegolas

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default


    Thank you. For your reply

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