• Apar Jaggi 6
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
queryStr='age__c=29'

Database.query('SELECT Id,Name,Age__c,Email__c,Course__c FROM Student__c WHERE '+queryStr+' LIMIT:20');
loadMoreData:function(component,event,helper){
        event.getSource().set("v.isLoading", true);
        component.set('v.loadMoreStatus', 'Loading....');
        var totalNumberofRows=component.get('v.totalNumberOfRows');
        var currentData=component.get("v.data");
        var counts = component.get("v.currentCount");
        var recordLimit=component.get("v.initialRows");
 if(component.get('v.data').length>=component.get('v.totalNumberOfRows')){
           // console.log("inside if");
                 component.set('v.enableInfiniteLoading', false);
                 component.set('v.loadMoreStatus', 'No more data to load');
        }else{
            var action=component.get("c.fetchRecordData");
            action.setParams({
               limitCount: recordLimit,
                offSetCount: counts
                
            });
            action.setCallback(this,function(response){
                var state=response.getState();
                console.log(state);
                
                if(state === "SUCCESS"){
                    var newData=response.getReturnValue();
                    console.log(newData);
                  /*  component.set("v.data",newData);
                    component.set("v.currentCount",(counts+recordLimit));*/
                }
            });
            $A.enqueueAction(action);
        }
    }