Threaded View

  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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar