1. #1
    Sencha Premium Member
    Join Date
    May 2013
    Location
    Stevenage, United Kingdom
    Posts
    44
    Vote Rating
    0
    uzair.sheikh is on a distinguished road

      0  

    Default filterBy only returns the last result.

    filterBy only returns the last result.


    I have this code, but this only returns the last result. I am passing the filtered data to dataview.list component.

    dataView List.png

    Code:
    var patientsStore = Ext.getStore('Patients');
    for(j=0; j<HospNosArray.length; j++) //HospNoArray has all the values from LocalStorage
    {
    	var HospNoVal = HospNosArray[j];
    	console.log("HospNoVal is: " + HospNoVal);
    
    	HospNoFilter = function (record) {
    		console.log("In filterBy Func" + record.get('hospitalNumber'));
    
    		if(record.get('hospitalNumber').match(HospNoVal))
    		{
    			console.log("Hosp No Matched: " + HospNoVal);
    			return true;
    		}
    		else {
    			console.log("No");
    			return false;
    		}
    	};
    }
    patientsStore.filterBy(HospNoFilter);
    patientsStore.load();
    I currently have two values in the localStorage which matches the results in the json file but above code only returns the last value.

    Can someone please point-out that where the problem is in the code above?

  2. #2
    Sencha Premium Member
    Join Date
    May 2013
    Location
    Stevenage, United Kingdom
    Posts
    44
    Vote Rating
    0
    uzair.sheikh is on a distinguished road

      0  

    Default


    This is kind of frustrating that no one bothered to help me but I have found a way now and it's all working.

  3. #3
    Sencha Premium Member
    Join Date
    May 2013
    Location
    Stevenage, United Kingdom
    Posts
    44
    Vote Rating
    0
    uzair.sheikh is on a distinguished road

      0  

    Default <Helping Hand>

    <Helping Hand>


    For someone who would face this issue, this is how i fixed my issue.

    1. Loop over all values in localstorage and create a concatenated string with 'condition statement' ( "|| (record.get('hospitalNumber').match(" + "\'" + HospNosArray[r] + "\'" + "))" )
    2. then remove first two OR sign from the final string (using .slice function of string)
    3. Created a function which runs for HospNosArray.length times
    4. Passed the string as a condition under if statement (using eval) and if their is a match then 'return true'

    Now i am getting all the matched values in the dataview.List.

    I hope this helps

    Regards,
    Uzair

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