Skip to content

Instantly share code, notes, and snippets.

View choudharymanish8585's full-sized avatar
💭
Never Settle

Manish Choudhari choudharymanish8585

💭
Never Settle
View GitHub Profile
({
showListViewData : function(component, event, helper) {
var strValue = component.find("inputName").get("v.value");
var setOptions = component.find("selectvalues");
component.set("v.objName", strValue);
var action = component.get("c.fetchListViews");
action.setParams({
"strObjName" : strValue
});
var optionValues = [];
({
showData : function(component, event, helper) {
helper.showListViewData(component, event, helper);
},
onListViewChange : function(component, event, helper) {
helper.showRecordsData(component, event, helper);
},
})
<aura:component controller="ListViewController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
<aura:attribute name="objName" type="String" />
<!--<aura:attribute name="objListView" type="String[]" />-->
<aura:attribute name="viewName" type="String" />
<div class="slds-box slds-theme_default">
<div class="slds-box">
<lightning:input aura:id="inputName" type="text" label="Enter Object Name:" required="true" />
<lightning:button variant="brand" label="Show List View" name="List View" onclick="{!c.showData}"/>
</div>
<br/><br/>
<aura:component extensible="true">
{!v.body}
</aura:component>
({
/*
* This method will call the server side action and will execute callback method
* it will also show error if generated any
* @param component (required) - Calling component
* @param method (required) - Server side methos name
* @param callback (required) - Callback function to be executed on server response
* @param params (optional) - parameter values to pass to server
* @param setStorable(optional) - if true, action response will be stored in cache
* */
<!--Exntends Base Component in Component Definition -->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
extends="c:Base" controller="AccountController" access="global" >
<aura:attribute name="data" type="Account[]"/>
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<aura:iteration items="{!v.data}" var="acc">
({
doInit : function(component, event, helper) {
helper.getAllAccounts(component, helper);
},
})
({
getAllAccounts : function(component, helper) {
//Calling base component's helper method to call Aura Method
helper.callServer(component, "c.getAccounts",
function(response){
if(response){
component.set("v.data", response);
//Calling showToast method of Base component
helper.showToast({
"title": "SUCCESS",
public class AccountController {
@AuraEnabled
public static List<Account> getAccounts(){
return [SELECT
Id, Name, Phone, Rating, My_Custom_Field__c, Active__c
FROM Account LIMIT 200];
}
}
<aura:event type="COMPONENT" description="Capture streaming api event. Takes message object parameter">
<aura:attribute name="message" type="Object" />
</aura:event>