Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:attribute name="recordId" type="Id" />
- <aura:attribute name="pageType" type="String" />
- <aura:attribute name="ActivityObjects" type="sObject" />
- <aura:attribute name="sobjectType" type="String" default="{!v.sObjectName}"/>
- <aura:attribute name="sobjectView" type="String" />
- <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
- <aura:handler event="force:showToast" action="{!c.refreshRecords}" />
- <article class="slds-card slds-p-around_x-small">
- <div class="bgColor">
- <div class="slds-section__title slds-m-bottom--x-small">
- <h2 class="slds-align-middle slds-truncate">History</h2>
- <div class="slds-p-left_small"/>
- <lightning:buttonMenu alternativeText="Filter Activity" variant="bare" onselect="{!c.handleMenuSelect}" iconName="utility:down">
- <lightning:menuItem label="Views" value="Views" />
- <lightning:menuItem label="Cases" value="Cases" />
- <lightning:menuItem label="Tasks" value="Tasks"/>
- <lightning:menuItem label="Events" value="Events" />
- <lightning:menuItem label="All" value="All" />
- </lightning:buttonMenu>
- <div class="slds-p-left_small">
- <ui:outputText value="{!v.sobjectView}"/>
- </div>
- </div>
- <ul>
- <aura:iteration items="{!v.ActivityObjects}" var="ActivityObj">
- <li>
- <c:Activity_DisplayComponent item="{!ActivityObj}" />
- </li>
- </aura:iteration>
- </ul>
- </div>
- </article>
- ({
- doInit: function(cmp, evt, helper) {
- helper.getActivity(cmp, event)
- },
- handleMenuSelect: function(cmp, event, helper) {
- helper.getReActivity(cmp,event)
- },
- refreshRecords: function(cmp, event, helper) {
- helper.getReRefreshActivityHelper(cmp, event)
- }
- })
- // this helper method for without filtering it will display all toegther
- related object in activity page
- ({
- getActivity : function(cmp) {
- // we having apex controller that fetch the getActivityActivity for filtering
- with soql queries.- that working fine
- const getActivity = cmp.get("c.getActivityActivity")// we having apex controller that fetch the getActivityActivity for filtering with soql queries.
- getActivity.setParams({ recordId : cmp.get("v.recordId"), objectName :
- cmp.get("v.sObjectName")})
- getActivity.setCallback(this, function(response) {
- const state = response.getState()
- if (cmp.isValid() && state === "SUCCESS") {
- cmp.set("v.ActivityObjects", response.getReturnValue())
- $A.get('e.force:refreshView').fire()
- }
- })
- $A.enqueueAction(getActivity)
- },
- // this helper method for with filtering it will display all toegther related object in activity page
- getReActivity : function(cmp,event){
- // we having apex controller that fetch the ("c.getReRefreshHistoryActivity")for filtering with soql queries.- that working fine
- const getReRefreshActivity = cmp.get("c.getReRefreshHistoryActivity")
- //category : event.getParam("value") - this category here, it will fetch the activity listed object eg : we have case, event, audit record object.
- getReActivity.setParams({ recordId : cmp.get("v.recordId"), category : event.getParam("value") , objectName : cmp.get("v.sObjectName")})
- const sobjectActivityDisplay=event.getParam("value")
- cmp.set("v.sobjectView", sobjectActivityDisplay)
- getReActivity.setCallback(this, function(response) {
- const state = response.getState()
- if (cmp.isValid() && state === "SUCCESS") {
- cmp.set("v.ActivityObjects", response.getReturnValue())
- $A.get('e.force:refreshView').fire()
- }
- })
- $A.enqueueAction(getReRefreshActivity)
- },
- -------------------------------------------------------
- // Refresh method helper here its working but when i use any filter any activity then filtering its not working
- // this one is same method but
- //
- getReRefreshActivityHelper : function(cmp, event){
- ({
- getReRefreshActivityHelper : function(cmp) {
- const getReRefreshActivityHelper= cmp.get("c.getActivityActivity")
- // i need to fetch the category value to filter, so that i able to
- category : event.getParam("value"), at the moment its throwing null values, bcz above method is used with menu item values that will fetch the category but here refreshing method thats why throwing null values
- getReActivity.setParams({ recordId : cmp.get("v.recordId"), category : event.getParam("value") , objectName : cmp.get("v.sObjectName")})
- getReRefreshActivityHelper.setCallback(this, function(response) {
- const state = response.getState()
- if (cmp.isValid() && state === "SUCCESS") {
- cmp.set("v.ActivityObjects", response.getReturnValue())
- $A.get('e.force:refreshView').fire()
- }
- })
- $A.enqueueAction(getReRefreshActivityHelper)
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement